Skip to content

Commit

Permalink
clean up and ready for first release
Browse files Browse the repository at this point in the history
  • Loading branch information
jimfangx committed Apr 21, 2020
1 parent e08a877 commit f89cc9d
Show file tree
Hide file tree
Showing 29 changed files with 415 additions and 613 deletions.
Binary file modified .DS_Store
Binary file not shown.
5 changes: 1 addition & 4 deletions commands/bataille.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,19 @@ exports.run = function (client, message) {
if (num === quotes[quotes.length - 1].lastNumber) num = getRandomIntInclusive(1, quotes.length - 1)
if (quotes[num] === quotes[quotes.length - 1].lastQuote) num = getRandomIntInclusive(1, quotes.length - 1)
translate(quotes[num].quote, { to: 'en' }).then(res => {
// console.log(res)
// console.log(quotes[num].quote)
const quoteSend = new Discord.MessageEmbed()
.setColor("#800080")
.setTitle(`Quote by ${quotes[num].author}`)
.setDescription(`"${res.text}"\n-${quotes[num].author}`)
.setFooter(`Disclaimer: This command is purely for satirical purposes. It does not represent the creator, the owner, or the user's views.`)
message.channel.send({ embed: quoteSend })
}).catch(err=>{
}).catch(err => {
console.log(err)
})
client.logger.log('info', `bataille command used by ${message.author.tag} ID: ${message.author.id} Time: ${Date()} Guild: ${message.guild}`)
quotes[quotes.length - 1].lastQuote = quotes[num].quote
quotes[quotes.length - 1].lastNumber = num
fs.writeFile('./quotesBataille.json', JSON.stringify(quotes, null, 2), function (err) {
if (err) return console.error(err);
// message.channel.send(`Prefix Successfully Changed to ${config.prefix}.`)
});
}
2 changes: 0 additions & 2 deletions commands/baudrillard.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ exports.run = function (client, message) {
const Discord = require('discord.js');
const fs = require("fs")
const translate = require('@vitalets/google-translate-api');
// var quoteTranslated = ""
let num = getRandomIntInclusive(1, quotes.length)
if (num === quotes[quotes.length - 1].lastNumber) num = getRandomIntInclusive(1, quotes.length - 1)
if (quotes[num] === quotes[quotes.length - 1].lastQuote) num = getRandomIntInclusive(1, quotes.length - 1)
Expand All @@ -30,6 +29,5 @@ exports.run = function (client, message) {
quotes[quotes.length - 1].lastNumber = num
fs.writeFile('./quotesBaudrillard.json', JSON.stringify(quotes, null, 2), function (err) {
if (err) return console.error(err);
// message.channel.send(`Prefix Successfully Changed to ${config.prefix}.`)
});
}
16 changes: 5 additions & 11 deletions commands/botinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,15 @@ function timeCon(time) {
seconds = seconds > 9 ? seconds : "" + seconds
return (parseInt(days) > 0 ? days + " days " : " ") + (parseInt(hours) === 0 && parseInt(days) === 0 ? "" : hours + " hours ") + minutes + " minutes " + seconds + " seconds."
}
// const winston = require('winston')
// var logger = new (winston.Logger)({
// transports: [
// new winston.transports.Console(),
// new winston.transports.File({ filename: './log.txt' })
// ]
// })

const fs = require('fs');
const dir = './commands'; //check if work or not...
const dir = './commands';
let commandsLength = 0;
fs.readdir(dir, (err, files) => {
commandsLength = (files.length);
});

exports.run = function (client, message, args, args2, cmd) {
exports.run = function (client, message, args) {
const Discord = require('discord.js');
const config = client.config;
const pkg = require("../package.json");
Expand Down Expand Up @@ -79,8 +73,8 @@ exports.run = function (client, message, args, args2, cmd) {
.addField(':arrow_left: Prefix', config.prefix, true)
.addField(':clipboard: # of Commands - Some not accessable to users', commandsLength - 1 + 20, true)
.addField(`:gem: Shards`, 'N/A', true)
// .addField(`:heart: Upvote ${config.name}`, `[Discord Bot List (discordbots.org)](https://discordbots.org/bot/460610749283172353)\n[Discord Bot List](https://discordbotlist.com/bots/460610749283172353)\n[Bots on Discord](https://bots.ondiscord.xyz/bots/460610749283172353)\n[Bots for Discord](https://botsfordiscord.com/bots/460610749283172353)`, true) // check if this is working with the custom emoji
// .addField(`:moneybag: Donate`, `[DonateBot](https://donatebot.io/checkout/430303752357019648)\n[Patreon](https://www.patreon.com/airfusion)`, true) //check if everything runs here.
// .addField(`:heart: Upvote ${config.name}`, `[Discord Bot List (discordbots.org)](https://discordbots.org/bot/460610749283172353)\n[Discord Bot List](https://discordbotlist.com/bots/460610749283172353)\n[Bots on Discord](https://bots.ondiscord.xyz/bots/460610749283172353)\n[Bots for Discord](https://botsfordiscord.com/bots/460610749283172353)`, true) // check if this is working with the custom emoji
// .addField(`:moneybag: Donate`, `[DonateBot](https://donatebot.io/checkout/430303752357019648)\n[Patreon](https://www.patreon.com/airfusion)`, true) //check if everything runs here.
message.channel.send({ embed: embednotNerdy })
}
client.logger.log('info', `botinfo command used by ${message.author.tag} ID: ${message.author.id} Time: ${Date()} Guild: ${guild}`)
Expand Down
4 changes: 2 additions & 2 deletions commands/breakbot.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
exports.run = function (client, message, args) {
exports.run = function (client, message) {

const superagent = require('superagent');
var guild = message.guild;

if (message.guild.id != "685646226942984206") return;
else {
superagent
Expand Down
6 changes: 1 addition & 5 deletions commands/capitalism.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,23 @@ exports.run = function (client, message) {
const Discord = require('discord.js');
const fs = require("fs")
const translate = require('@vitalets/google-translate-api');
// var quoteTranslated = ""
let num = getRandomIntInclusive(1, quotes.length)
if (num === quotes[quotes.length - 1].lastNumber) num = getRandomIntInclusive(1, quotes.length - 1)
if (quotes[num] === quotes[quotes.length - 1].lastQuote) num = getRandomIntInclusive(1, quotes.length - 1)
translate(quotes[num].quote, { to: 'en' }).then(res => {
// console.log(res)
// console.log(quotes[num].quote)
const quoteSend = new Discord.MessageEmbed()
.setColor("#2c80c6")
.setTitle(`Quote by ${quotes[num].author}`)
.setDescription(`"${res.text}"\n-${quotes[num].author}`)
.setFooter(`Disclaimer: This command is purely for satirical purposes. It does not represent the creator, the owner, or the user's views.`)
message.channel.send({ embed: quoteSend })
}).catch(err=>{
}).catch(err => {
console.log(err)
})
client.logger.log('info', `capitalism command used by ${message.author.tag} ID: ${message.author.id} Time: ${Date()} Guild: ${message.guild}`)
quotes[quotes.length - 1].lastQuote = quotes[num].quote
quotes[quotes.length - 1].lastNumber = num
fs.writeFile('./quotesCap.json', JSON.stringify(quotes, null, 2), function (err) {
if (err) return console.error(err);
// message.channel.send(`Prefix Successfully Changed to ${config.prefix}.`)
});
}
2 changes: 1 addition & 1 deletion commands/checklist.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exports.run = function (client, message, args, args2, cmd) {
exports.run = function (client, message) {
const Discord = require('discord.js');
const config = client.config;
var guild = message.guild;
Expand Down
6 changes: 1 addition & 5 deletions commands/communism.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,23 @@ exports.run = function (client, message) {
const Discord = require('discord.js');
const fs = require("fs")
const translate = require('@vitalets/google-translate-api');
// var quoteTranslated = ""
let num = getRandomIntInclusive(1, quotes.length)
if (num === quotes[quotes.length - 1].lastNumber) num = getRandomIntInclusive(1, quotes.length - 1)
if (quotes[num] === quotes[quotes.length - 1].lastQuote) num = getRandomIntInclusive(1, quotes.length - 1)
translate(quotes[num].quote, { to: 'en' }).then(res => {
// console.log(res)
// console.log(quotes[num].quote)
const quoteSend = new Discord.MessageEmbed()
.setColor("#dd0200")
.setTitle(`Quote by ${quotes[num].author}`)
.setDescription(`"${res.text}"\n-${quotes[num].author}`)
.setFooter(`Disclaimer: This command is purely for satirical purposes. It does not represent the creator, the owner, or the user's views.`)
message.channel.send({ embed: quoteSend })
}).catch(err=>{
}).catch(err => {
console.log(err)
})
client.logger.log('info', `communism command used by ${message.author.tag} ID: ${message.author.id} Time: ${Date()} Guild: ${message.guild}`)
quotes[quotes.length - 1].lastQuote = quotes[num].quote
quotes[quotes.length - 1].lastNumber = num
fs.writeFile('./quotes.json', JSON.stringify(quotes, null, 2), function (err) {
if (err) return console.error(err);
// message.channel.send(`Prefix Successfully Changed to ${config.prefix}.`)
});
}
3 changes: 1 addition & 2 deletions commands/dm.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ exports.run = function (client, message, args, args2, cmd) {
.addField("**Usage:**", `${config.prefix}dm <@username> <Your message>`)
.addField("**Example:**", `${config.prefix}dm @AirFusion hello`)
.addField("**Expected Result From Example:**", "Mentioned user should get a DM from the bot with the correct message & message in chat should be deleted.")
// .addField("**Alies**", "-msg")
if (!user || args[1]===undefined) return message.channel.send({ embed: embed1 })
if (!user || args[1] === undefined) return message.channel.send({ embed: embed1 })
const embed = new Discord.MessageEmbed()
.setColor("#008000")
.setTitle(`You Have a New Message From ${message.author.username}`)
Expand Down
13 changes: 6 additions & 7 deletions commands/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ exports.run = function (client, message, args) {
const Discord = require('discord.js');
const config = client.config;
const embed1 = new Discord.MessageEmbed()
.setColor("#f0ffff")
.setDescription("**Command: **" + `${config.prefix}embed`)
.addField("**Usage:**", `${config.prefix}embed <message to embed>`)
.addField("**Example:**", `${config.prefix}embed hello`)
.addField("**Expected Result From Example:**", "Bot will send a embeded message to channel containing your message.")
// .addField("**Alies**", "-msg")
if (args.join(' ')==="") return message.channel.send({ embed: embed1 })
.setColor("#f0ffff")
.setDescription("**Command: **" + `${config.prefix}embed`)
.addField("**Usage:**", `${config.prefix}embed <message to embed>`)
.addField("**Example:**", `${config.prefix}embed hello`)
.addField("**Expected Result From Example:**", "Bot will send a embeded message to channel containing your message.")
if (args.join(' ') === "") return message.channel.send({ embed: embed1 })
const embed = new Discord.MessageEmbed()
.setColor("#3f00ff")
.setAuthor("Author: " + message.author.username + "\n")
Expand Down
20 changes: 10 additions & 10 deletions commands/endround.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ exports.run = function (client, message, args) {
const currentlyDebating = message.guild.roles.cache.find(role => role.name === "Currently Debating");
const currentlyJudging = message.guild.roles.cache.find(role => role.name === "Currently Judging")
const help = new Discord.MessageEmbed()
.setColor("#f0ffff")
.setDescription("**Command: **" + `${config.prefix}endround`)
.addField("**Usage:**", `${config.prefix}endround <Round Name> <Decision: Spaces supported>`)
.addField("**Example:**", `${config.prefix}endround AF-v-ND aff`)
.addField("**Expected Result From Example:**", "Bot ends round (Note: Round data will be deleted from database) and outputs round info.")
.setColor("#f0ffff")
.setDescription("**Command: **" + `${config.prefix}endround`)
.addField("**Usage:**", `${config.prefix}endround <Round Name> <Decision: Spaces supported>`)
.addField("**Example:**", `${config.prefix}endround AF-v-ND aff`)
.addField("**Expected Result From Example:**", "Bot ends round (Note: Round data will be deleted from database) and outputs round info.")
if (args.join(' ') === "" || args[0] === '' || args[1] === '' || args[2] === '') {
message.channel.send({ embed: help })
return;
} else {
var roundInfo = client.rounds.get(guild.id + args[0]);
if (roundInfo === undefined) {
message.channel.send({embed: help})
message.channel.send({ embed: help })
return;
}
var decision = "";
Expand All @@ -25,8 +25,8 @@ exports.run = function (client, message, args) {
for (var i = 1; i < args.length; i++) {
decision += args[i]
}
if (decision==="") {
message.channel.send({embed: help})
if (decision === "") {
message.channel.send({ embed: help })
return;
}
debatersID = roundInfo.debaters.split(" ")
Expand All @@ -45,9 +45,9 @@ exports.run = function (client, message, args) {
.addField(`Decision`, decision)
.setFooter(config.name)
.setTimestamp()

message.channel.send({ embed: results })
guild.channels.cache.find(val => val.name === "debatelog").send({embed: results}).catch(err => console.error(err))
guild.channels.cache.find(val => val.name === "debatelog").send({ embed: results }).catch(err => console.error(err))
client.rounds.delete(guild.id + args[0])
client.logger.log('info', `endround command used by ${message.author.tag} ID: ${message.author.id} Time: ${Date()} Guild: ${guild}`)
}
Expand Down
15 changes: 7 additions & 8 deletions commands/feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ exports.run = function (client, message, args) {
message.reply("Feedback received from Discord Chatbox! Thank you for your feedback!")
message.delete()
message.delete()
// message.delete()
client.users.cache.find(val1 => val1.id === config.owner).send(`New feedback from ${message.author.tag} from server: ${message.guild.name}. Message/Feedback: ${args.join(' ')}`)
} else {
const embed1 = new Discord.MessageEmbed()
.setColor("#f0ffff")
.setDescription("**Command: **" + `${config.prefix}feedback`)
.addField("**Usage:**", `${config.prefix}feedback <your feedback>`)
.addField("**Example:**", `${config.prefix}feedback Better hosting for db8 bot!`)
.addField("**Expected Result From Example:**", "DMs the owner of the bot with your feedback.")
message.channel.send({embed: embed1})
.setColor("#f0ffff")
.setDescription("**Command: **" + `${config.prefix}feedback`)
.addField("**Usage:**", `${config.prefix}feedback <your feedback>`)
.addField("**Example:**", `${config.prefix}feedback Better hosting for db8 bot!`)
.addField("**Expected Result From Example:**", "DMs the owner of the bot with your feedback.")

message.channel.send({ embed: embed1 })
client.logger.log('info', `feedback command used by ${message.author.tag} ID: ${message.author.id} Time: ${Date()} Guild: ${guild}`)
}
}
31 changes: 6 additions & 25 deletions commands/get.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
exports.run = function (client, message, args) {
// let { PythonShell } = require('python-shell')
// let pyshell = new PythonShell('./script.py');
const superagent = require('superagent');
// const fs = require("fs");
// const request = require("request-promise-native");
// const scholar = require('google-scholar-extended')
const querystring = require('querystring');
var scholar = require('google-scholar-link')
const Discord = require('discord.js');
const config = client.config
// var eprint = {};
var scholarLink = ""
if (args.join(' ') === "" || args.join(' ').indexOf("http")===-1) {
if (args.join(' ') === "" || args.join(' ').indexOf("http") === -1) {
const help = new Discord.MessageEmbed()
.setColor("#f0ffff")
.setDescription("**Command: **" + `${config.prefix}get`)
Expand All @@ -30,34 +24,21 @@ exports.run = function (client, message, args) {
// console.log(found)
if (found === null) {
message.reply(`Not found on Sci-Hub! :( Try the following Google Scholar link (Incase they have a free PDF)`)
// console.log(scholar(querystring.escape(args.join(' '))))
scholarLink=scholar(querystring.escape(args.join(' ')))
scholarLink=scholarLink.substring(0,scholarLink.length-1)
// console.log(scholarLink)
scholarLink=scholarLink.substring(0,scholarLink.indexOf('"'))+scholarLink.substring(scholarLink.indexOf('"')+1)
scholarLink = scholar(querystring.escape(args.join(' ')))
scholarLink = scholarLink.substring(0, scholarLink.length - 1)
scholarLink = scholarLink.substring(0, scholarLink.indexOf('"')) + scholarLink.substring(scholarLink.indexOf('"') + 1)
message.channel.send(scholarLink)

} else {
if (found[1].indexOf("https") === -1) {
found[1] = "https:" + found[1];
}
// message.channel.send(found)
// async function downloadPDF(pdfURL, outputFilename) {
// let pdfBuffer = await request.get({ uri: pdfURL, encoding: null });
// console.log("Writing downloaded PDF file to " + outputFilename + "...");
// fs.writeFileSync(outputFilename, pdfBuffer);
// }

// downloadPDF(found[1], `./${args.join(' ')}`);
// console.log(found[1])
try {
message.channel.send(found[1])
message.channel.send({
files: [found[1] + ".pdf"]
}).catch(err => console.log(err))
} catch (e) {
// message.channel.send("PDF too large... Sending Sci-hub link.")
// message.channel.send(found[1])
console.log(e)
}
}
Expand All @@ -81,7 +62,7 @@ exports.run = function (client, message, args) {
// console.log('finished');
// });
// scholar rate limited by google :(

// ARCHIVAL1:

// // message.reply(`Not found on sci-hub!`)
Expand Down
Loading

0 comments on commit f89cc9d

Please sign in to comment.