diff --git a/commands/admin/fakejoin.js b/commands/admin/fakejoin.js index ada83dc..998e49e 100644 --- a/commands/admin/fakejoin.js +++ b/commands/admin/fakejoin.js @@ -33,7 +33,7 @@ class fakejoinCommand extends Command { else member = message.guild.members.resolve(message.author.id); } else { - return message.channel.send('There is no join channel setup'); + return message.reply('There is no join channel setup'); } this.client.emit('guildMemberAdd', member); diff --git a/commands/admin/fakeleave.js b/commands/admin/fakeleave.js index be66301..2998501 100644 --- a/commands/admin/fakeleave.js +++ b/commands/admin/fakeleave.js @@ -33,7 +33,7 @@ class fakeleaveCommand extends Command { else member = message.guild.members.resolve(message.author.id); } else { - return message.channel.send('There is no leave channel setup'); + return message.reply('There is no leave channel setup'); } this.client.emit('guildMemberRemove', member); diff --git a/commands/fun/cleverbot.js b/commands/fun/cleverbot.js index fdd1878..31d937b 100644 --- a/commands/fun/cleverbot.js +++ b/commands/fun/cleverbot.js @@ -27,14 +27,14 @@ class CleverBotCommand extends Command { } async exec(message, args) { - let loadingmsg = await message.channel.send('Processing! '); + let loadingmsg = await message.reply('Processing! '); if (!conversation[message.guild.id]) conversation[message.guild.id] = []; if (!conversation[0]) { cleverbot(args.message).then(response => { conversation[message.guild.id].push(args.message); conversation[message.guild.id].push(response); - return message.channel.send(response) + return message.reply(response) .then(() => { loadingmsg.delete(); }); @@ -43,7 +43,7 @@ class CleverBotCommand extends Command { cleverbot(args.message, conversation[message.guild.id]).then(response => { conversation[message.guild.id].push(args.message); conversation[message.guild.id].push(response); - return message.channel.send(response) + return message.reply(response) .then(() => { loadingmsg.delete(); }); diff --git a/commands/fun/doesntexist.js b/commands/fun/doesntexist.js index df6e042..c60a021 100644 --- a/commands/fun/doesntexist.js +++ b/commands/fun/doesntexist.js @@ -22,7 +22,7 @@ class dosentexistCommand extends Command { const dest = fs.createWriteStream('./asset/img/de.png'); res.body.pipe(dest); dest.on('finish', () => { - return message.channel.send({files: ['./asset/img/de.png']}); + return message.reply({files: ['./asset/img/de.png']}); }); }); } } diff --git a/commands/fun/explosm.js b/commands/fun/explosm.js index daa6191..7751fbf 100644 --- a/commands/fun/explosm.js +++ b/commands/fun/explosm.js @@ -17,7 +17,7 @@ class explosmCommand extends Command { async exec(message) { extract({ uri: 'http://explosm.net/rcg' }, (err, res) => { - return message.channel.send({files: [res.ogImage]}); + return message.reply({files: [res.ogImage]}); }); } diff --git a/commands/fun/fakebot.js b/commands/fun/fakebot.js index 5e7c991..1a24564 100644 --- a/commands/fun/fakebot.js +++ b/commands/fun/fakebot.js @@ -69,11 +69,6 @@ class fakebotCommand extends Command { else webhook.send(args.message); - setTimeout(() => { - webhook.delete({ - reason: `Fakebot/user command triggered by: ${message.author.username}` - }); - }, 3000); }); }); } diff --git a/commands/fun/reddit.js b/commands/fun/reddit.js index b994ee6..2b0ff6c 100644 --- a/commands/fun/reddit.js +++ b/commands/fun/reddit.js @@ -38,14 +38,14 @@ class RedditCommand extends Command { }).then((response) => { console.log(response); if (response.error == 404) - return message.channel.send('Not a valid subreddit'); + return message.reply('Not a valid subreddit'); if (response.data.dist == 0) - return message.channel.send('Not a valid subreddit'); + return message.reply('Not a valid subreddit'); let i = Math.floor((Math.random() * response.data.children.length)); if (response.data.children[i].data.over_18 == true && !message.channel.nsfw) - return message.channel.send('No nsfw'); + return message.reply('No nsfw'); const redditEmbed = this.client.util.embed() .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle(response.data.children[i].data.title) @@ -53,8 +53,8 @@ class RedditCommand extends Command { .setURL('https://reddit.com' + response.data.children[i].data.permalink) .setFooter(`/r/${response.data.children[i].data.subreddit} | ⬆ ${response.data.children[i].data.ups} 🗨 ${response.data.children[i].data.num_comments}`); - message.channel.send(redditEmbed); - message.channel.send(response.data.children[i].data.url); + message.reply(redditEmbed); + message.reply(response.data.children[i].data.url); }); } } diff --git a/commands/fun/spb.js b/commands/fun/spb.js index 8669f65..fdd0d48 100644 --- a/commands/fun/spb.js +++ b/commands/fun/spb.js @@ -28,7 +28,7 @@ class spbCommand extends Command { async exec(message, args) { if (!args.link || !args.link.href.includes('shitpostbot.com/template/')) { - return message.channel.send('Need a Shitpostbot 5000 template link!\nYou can find them here! '); + return message.reply('Need a Shitpostbot 5000 template link!\nYou can find them here! '); } let link = args.link.href.replace('template', 'preview'); @@ -38,7 +38,7 @@ class spbCommand extends Command { const dest = fs.createWriteStream(`${os.tmpdir()}/${message.id}.jpg`); res.body.pipe(dest); dest.on('finish', () => { - return message.channel.send({files: [`${os.tmpdir()}/${message.id}.jpg`]}); + return message.reply({files: [`${os.tmpdir()}/${message.id}.jpg`]}); }); }); } diff --git a/commands/fun/ytp.js b/commands/fun/ytp.js index feecdad..207e227 100644 --- a/commands/fun/ytp.js +++ b/commands/fun/ytp.js @@ -143,7 +143,7 @@ class ytpCommand extends Command { } }); - return message.channel.send(`There is currently ${mp4.length} videos, you can add yours by doing \`\`${this.client.commandHandler.prefix[0]}ytp --add (link or attachment)\`\``); + return message.reply(`There is currently ${mp4.length} videos, you can add yours by doing \`\`${this.client.commandHandler.prefix[0]}ytp --add (link or attachment)\`\``); } if (args.listproxy) { @@ -161,7 +161,7 @@ class ytpCommand extends Command { .setDescription(proxys.join('\n')) .setFooter('You can help me get more proxy by either donating to me or providing a proxy for me'); - return message.channel.send(Embed); + return message.reply(Embed); } if (args.add) { @@ -169,7 +169,7 @@ class ytpCommand extends Command { const blacklist = await ytpblacklist.findOne({where: {userID:message.author.id}}); if (blacklist) { - return message.channel.send(`You have been blacklisted for the following reasons: \`${blacklist.get('reason')}\` be less naughty next time.`); + return message.reply(`You have been blacklisted for the following reasons: \`${blacklist.get('reason')}\` be less naughty next time.`); } */ @@ -178,7 +178,7 @@ class ytpCommand extends Command { if (!proxy[args.proxy]) args.proxy = 0; } - let loadingmsg = await message.channel.send('Downloading '); + let loadingmsg = await message.reply('Downloading '); let url; if (args.link) @@ -204,15 +204,15 @@ class ytpCommand extends Command { args.proxyAuto = true; } - if (!proxy[args.proxy]) return message.channel.send('`HTTP Error 429: Too Many Requests.`\nThe website you tried to download from probably has the bot blocked along with its proxy'); + if (!proxy[args.proxy]) return message.reply('`HTTP Error 429: Too Many Requests.`\nThe website you tried to download from probably has the bot blocked along with its proxy'); loadingmsg.delete(); return this.client.commandHandler.runCommand(message, this.client.commandHandler.findCommand('ytp'), args); } - if (err.includes('Error: status code 403')) return message.channel.send('`HTTP Error 403: Forbidden.`\nThe video you tried to download is not publicly available therefor the bot can\'t download it.'); + if (err.includes('Error: status code 403')) return message.reply('`HTTP Error 403: Forbidden.`\nThe video you tried to download is not publicly available therefor the bot can\'t download it.'); - return message.channel.send(err, { code: true }); + return message.reply(err, { code: true }); }) .on('end', async output => { @@ -280,12 +280,12 @@ class ytpCommand extends Command { }); } else { loadingmsg.delete(); - return message.channel.send('You need a valid video link!'); + return message.reply('You need a valid video link!'); } } - if (!message.channel.nsfw && !args.force) return message.channel.send(`Please execute this command in an NSFW channel ( Content might not be NSFW but since the video are user submitted better safe than sorry ) OR do \`\`${this.client.commandHandler.prefix[0]}ytp --force\`\` to make the command work outside of nsfw channel BE AWARE THAT IT WON'T CHANGE THE FINAL RESULT SO NSFW CAN STILL HAPPEN`); + if (!message.channel.nsfw && !args.force) return message.reply(`Please execute this command in an NSFW channel ( Content might not be NSFW but since the video are user submitted better safe than sorry ) OR do \`\`${this.client.commandHandler.prefix[0]}ytp --force\`\` to make the command work outside of nsfw channel BE AWARE THAT IT WON'T CHANGE THE FINAL RESULT SO NSFW CAN STILL HAPPEN`); // Read userVid folder and select random vid and only take .mp4 let mp4 = []; @@ -308,7 +308,7 @@ class ytpCommand extends Command { } } - let loadingmsg = await message.channel.send(`Processing, this can take a ***long*** time, i'll ping you when i finished \nSome info: There are currently ${mp4.length} videos, you can add yours by doing \`\`${this.client.commandHandler.prefix[0]}ytp --add (link or attachment). Thanks for contributing!\`\``); + let loadingmsg = await message.reply(`Processing, this can take a ***long*** time, i'll ping you when i finished \nSome info: There are currently ${mp4.length} videos, you can add yours by doing \`\`${this.client.commandHandler.prefix[0]}ytp --add (link or attachment)\`\`\nLike ytp? Why not check out https://ytp.namejeff.xyz/`); let options = { @@ -353,7 +353,7 @@ class ytpCommand extends Command { return message.reply('Here is your YTP! Remember, it might contain nsfw, so be careful!', {files: [`${os.tmpdir()}/${message.id}_YTP.mp4`]}) .catch(err => { console.error(err); - return message.channel.send('Whoops, look like the vid might be too big for discord, my bad, please try again'); + return message.reply('Whoops, look like the vid might be too big for discord, my bad, please try again'); }); }) .catch(err => { @@ -368,7 +368,7 @@ class ytpCommand extends Command { return message.reply({files: [Math.random() < 0.5 ? './asset/ytp/error1.mp4' : './asset/ytp/error2.mp4']}) .catch(err => { // In case it can't send the video for some reason console.error(err); - return message.channel.send('Oh no, an error has occurred! please try again. If this happens alot, you should report this to the developers.'); + return message.reply('Oh no, an error has occurred! please try again. If this happens alot, you should report this to the developers.'); }); } diff --git a/commands/general/advice.js b/commands/general/advice.js index 1416c87..aec1af9 100644 --- a/commands/general/advice.js +++ b/commands/general/advice.js @@ -21,11 +21,11 @@ class AdviceCommand extends Command { }).then((response) => { const adviceEmbed = this.client.util.embed() .setColor(message.member ? message.member.displayHexColor : 'NAVY') - .setTitle(response.slip.slip_id) + .setTitle(response.slip.id) .setDescription(response.slip.advice); - message.channel.send(adviceEmbed); + message.reply(adviceEmbed); }); } diff --git a/commands/general/clap.js b/commands/general/clap.js index 297aba3..bf96636 100644 --- a/commands/general/clap.js +++ b/commands/general/clap.js @@ -30,8 +30,7 @@ class ClapCommand extends Command { args.text = rand.random(args.text, message); let clap = args.text.replace(/ /g, ' 👏 '); - message.delete(); - message.channel.send(`${clap} 👏`); + message.reply(`${clap} 👏`); } } diff --git a/commands/general/randomizer.js b/commands/general/randomizer.js index e44e347..810d36f 100644 --- a/commands/general/randomizer.js +++ b/commands/general/randomizer.js @@ -27,7 +27,7 @@ class randomizerCommand extends Command { async exec(message, args) { let words = args.text.split(' '); - return message.channel.send(words[Math.floor((Math.random() * words.length))]); + return message.reply(words[Math.floor((Math.random() * words.length))]); } } diff --git a/commands/general/tweet.js b/commands/general/tweet.js index db3b5f9..ea9adeb 100644 --- a/commands/general/tweet.js +++ b/commands/general/tweet.js @@ -34,7 +34,7 @@ class tweetCommand extends Command { async exec(message, args) { let Attachment = (message.attachments).array(); - if (!Attachment[0] && !args.text) return message.channel.send('You need to input something for me to tweet!'); + if (!Attachment[0] && !args.text) return message.reply('You need to input something for me to tweet!'); let date = new Date(); // see if user is not banned @@ -42,24 +42,33 @@ class tweetCommand extends Command { const blacklist = await TwitterBlacklist.findOne({where: {userID:message.author.id}}); if (blacklist) { - return message.channel.send(`You have been blacklisted for the following reasons: \`${blacklist.get('reason')}\` be less naughty next time.`); + return message.reply(`You have been blacklisted for the following reasons: \`${blacklist.get('reason')}\` be less naughty next time.`); } */ // If account is less than 6 months old don't accept the tweet ( alt prevention ) if (message.author.createdAt > date.setMonth(date.getMonth() - 6)) { - return message.channel.send('Your account is too new to be able to use this command!'); + return message.reply('Your account is too new to be able to use this command!'); } // If account is less than 1 year old don't accept attachment if (Attachment[0] && message.author.createdAt > date.setFullYear(date.getFullYear() - 1 )) { - return message.channel.send('Your account need to be 1 year or older to be able to send attachment!'); + return message.reply('Your account need to be 1 year or older to be able to send attachment!'); } + // remove zero width space and use the dictionary thingy + let text = ''; if (args.text) { + text = args.text.replace('​', ''); + + text = rand.random(text, message); + } + + if (text) { // Detect banned word (Blacklist the user directly) - if (wordToCensor.includes(args.text)) { + if (wordToCensor.includes(text) || wordToCensor.includes(text.substr(0, text.length - 1)) || wordToCensor.includes(text.substr(1, text.length))) { const body = {type:'tweet', uid: message.author.id, reason: 'Automatic ban from banned word.'}; Blacklists.create(body); + /* const body = {userID: message.author.id, reason: }; TwitterBlacklist.create(body); @@ -72,7 +81,7 @@ class tweetCommand extends Command { // Do not allow discord invites if (args.text.includes('discord.gg') || args.text.includes('discord.com/invite/')) return message.channel.send('No discord invite allowed.'); } - + const client = this.client; let T = new Twit({ @@ -82,27 +91,6 @@ class tweetCommand extends Command { access_token_secret: twiTokenSecret }); - /* - // Censor words - let censor = reload('../../json/censor.json'); - let uncensor = reload('../../json/uncensor.json'); - filter.addWords(...censor); - filter.removeWords(...uncensor); - */ - - // remove zero width space - let text = ''; - if (args.text) { - text = args.text.replace('​', ''); - - /* - //Filter out swear word - text = filter.clean(text); - */ - - text = rand.random(text, message); - } - try { // Make sure there is an attachment and if its an image if (Attachment[0]) { @@ -116,9 +104,9 @@ class tweetCommand extends Command { let fileSize = file.size / 1000000.0; if ((Attachment[0].name.endsWith('.jpg') || Attachment[0].name.endsWith('.png')) && fileSize > 5) { - return message.channel.send('Images can\'t be larger than 5 MB!'); + return message.reply('Images can\'t be larger than 5 MB!'); } else if (Attachment[0].name.endsWith('.gif') && fileSize > 15) { - return message.channel.send('Gifs can\'t be larger than 15 MB!'); + return message.reply('Gifs can\'t be larger than 15 MB!'); } let b64Image = fs.readFileSync(`${os.tmpdir()}/${Attachment[0].name}`, { encoding: 'base64'}); @@ -126,7 +114,7 @@ class tweetCommand extends Command { if (err) { console.log('OH NO AN ERROR!!!!!!!'); console.error(err); - return message.channel.send('OH NO!!! AN ERROR HAS occurred!!! please hold on while i find what\'s causing this issue! '); + return message.reply('OH NO!!! AN ERROR HAS occurred!!! please hold on while i find what\'s causing this issue! '); } else { Tweet(data); } @@ -134,14 +122,14 @@ class tweetCommand extends Command { }); }); } else { - return message.channel.send('File type not supported, you can only send jpg/png/gif'); + return message.reply('File type not supported, you can only send jpg/png/gif'); } } else { Tweet(); } } catch(err) { console.error(err); - return message.channel.send('Oh no, an error has occurred :('); + return message.reply('Oh no, an error has occurred :('); } function Tweet(data) { @@ -162,13 +150,13 @@ class tweetCommand extends Command { T.post('statuses/update', options, function (err, response) { if (err) { - if (err.code == 88) return message.channel.send(err.message); // Rate limit exceeded - if (err.code == 186) return message.channel.send(`${err.message} Your message was ${text.length} characters, you need to remove ${text.length - 280} characters (This count may be inaccurate if your message contained link)`); // Tweet needs to be a bit shorter. - if (err.code == 187) return message.channel.send(err.message); // Status is a duplicate. - if (err.code == 326) return message.channel.send(err.message); // To protect our users from spam and other malicious activity, this account is temporarily locked. + if (err.code == 88) return message.reply(err.message); // Rate limit exceeded + if (err.code == 186) return message.reply(`${err.message} Your message was ${text.length} characters, you need to remove ${text.length - 280} characters (This count may be inaccurate if your message contained link)`); // Tweet needs to be a bit shorter. + if (err.code == 187) return message.reply(err.message); // Status is a duplicate. + if (err.code == 326) return message.reply(err.message); // To protect our users from spam and other malicious activity, this account is temporarily locked. console.error('OH NO!!!!'); console.error(err); - return message.channel.send('OH NO!!! AN ERROR HAS occurred!!! please hold on while i find what\'s causing this issue! '); + return message.reply('OH NO!!! AN ERROR HAS occurred!!! please hold on while i find what\'s causing this issue! '); } const tweetid = response.id_str; @@ -200,7 +188,7 @@ class tweetCommand extends Command { channel = client.channels.resolve(twiChannel); channel.send({embed: Embed}); - return message.channel.send(`Go see ur epic tweet ${TweetLink}`); + return message.reply(`Go see ur epic tweet ${TweetLink}`); }); } diff --git a/commands/hidden/owned.js b/commands/hidden/owned.js index 5d7e365..d5fa05f 100644 --- a/commands/hidden/owned.js +++ b/commands/hidden/owned.js @@ -28,9 +28,9 @@ class OwnedCommand extends Command { if (args.member) { if (args.member.id == this.client.user.id) { - return message.channel.send('You really thought you could own me?, pathetic...'); + return message.reply('You really thought you could own me?, pathetic...'); } else if (args.member.id == this.client.ownerID) { - return message.channel.send('You really thought you could own him?, pathetic...'); + return message.reply('You really thought you could own him?, pathetic...'); } else if (args.member.id == '286054184623538177' || args.member.id == '172112210863194113') { owned = message.author; } @@ -41,9 +41,9 @@ class OwnedCommand extends Command { return message.reply(ownedMessage); } - return message.channel.send(`${owned}, ${ownedMessage}`); + return message.send(`${owned}, ${ownedMessage}`); } else { - return message.channel.send(ownedMessage); + return message.send(ownedMessage); } } } diff --git a/commands/hidden/premium.js b/commands/hidden/premium.js index 10cc62e..107edcd 100644 --- a/commands/hidden/premium.js +++ b/commands/hidden/premium.js @@ -15,7 +15,7 @@ class premiumCommand extends Command { } async exec(message) { - return message.channel.send('EPIC TF2 FEATURE HERE !!!!!!111111 YOU CAN FLY AND CHEAT !!!!!!!!!!!!!!!!! ALSO PREMIUM SONG AND ANNOY EVERYONE AND FLEX ON EM HATERS WITH CUSTOM SKIN!!!!'); + return message.reply('EPIC TF2 FEATURE HERE !!!!!!111111 YOU CAN FLY AND CHEAT !!!!!!!!!!!!!!!!! ALSO PREMIUM SONG AND ANNOY EVERYONE AND FLEX ON EM HATERS WITH CUSTOM SKIN!!!!'); } } diff --git a/commands/hidden/sex.js b/commands/hidden/sex.js index efb3457..fcbf90f 100644 --- a/commands/hidden/sex.js +++ b/commands/hidden/sex.js @@ -14,7 +14,7 @@ class sexCommand extends Command { } async exec(message) { - return message.channel.send('69\nHaha lol Le sex numbers xDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD'); + return message.reply('69\nHaha lol Le sex numbers xDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD'); } } diff --git a/commands/hidden/unowned.js b/commands/hidden/unowned.js index bbd0bcb..6774efa 100644 --- a/commands/hidden/unowned.js +++ b/commands/hidden/unowned.js @@ -22,12 +22,12 @@ class unownedCommand extends Command { async exec(message, args) { if (args.member) { - return message.channel.send('You can\'t do that! that\'s illegal!'); + return message.reply('You can\'t do that! that\'s illegal!'); } if (message.author.id == '267065637183029248') { - return message.channel.send('You have been sucessfully unowned'); + return message.reply('You have been sucessfully unowned'); } - return message.channel.send('You can\'t unown what has already been owned <:classictroll:488559136494321703>'); + return message.reply('You can\'t unown what has already been owned <:classictroll:488559136494321703>'); } } diff --git a/commands/images/poster.js b/commands/images/poster.js index 218d702..3f36c77 100644 --- a/commands/images/poster.js +++ b/commands/images/poster.js @@ -1,4 +1,5 @@ const { Command } = require('discord-akairo'); +const attachment = require('../../utils/attachment'); const gm = require('gm').subClass({imageMagick: true}); const os = require('os'); const fetch = require('node-fetch'); @@ -60,22 +61,30 @@ class posterCommand extends Command { async exec(message, args) { let options = args.message.trim().split('|'); + let url; + + console.log(args.link); + + if (args.link !== '^') + url = new URL(args.link); + else + url = await attachment(message); + + console.log(url); + if (options[0] == undefined) options[0] = ''; else if (options[1] == undefined) options[1] = ''; - let url = args.link; - - if (!url) { - return message.channel.send('You need an image to use this command!'); + return message.reply('You need an image to use this command!'); } - let loadingmsg = await message.channel.send('Processing '); + let loadingmsg = await message.reply('Processing '); // Create new graphicsmagick instance - fetch(url) + fetch(url.href) .then(res => { const dest = fs.createWriteStream(`${os.tmpdir()}/${message.id}`); res.body.pipe(dest); @@ -93,7 +102,7 @@ class posterCommand extends Command { img.format(function(err, format) { if (err) { console.error(err); - return message.channel.send('An error has occurred, is it an image?'); + return message.reply('An error has occurred, is it an image?'); } let output1 = `${os.tmpdir()}/poster${message.author.id}.${format.toLowerCase()}`; let output2 = `${os.tmpdir()}/poster${message.id}.${format.toLowerCase()}`; @@ -127,7 +136,7 @@ class posterCommand extends Command { .write(output1, function(err) { if (err) { console.error(err); - return message.channel.send('An error just occurred! is it a static image?'); + return message.reply('An error just occurred! is it a static image?'); } // Chop the top part of the image let img2 = gm(output1); @@ -136,7 +145,7 @@ class posterCommand extends Command { loadingmsg.delete(); if (err) { console.error(err); - return message.channel.send('An error just occurred! is it a static image?'); + return message.reply('An error just occurred! is it a static image?'); } message.delete(); return message.channel.send(`Made by ${message.author.username}`,{files: [output2]}) @@ -152,7 +161,7 @@ class posterCommand extends Command { }) .catch((err) => { console.error(err); - return message.channel.send(`Please input a correct link \`${err}\``); + return message.reply(`Please input a correct link \`${err}\``); }); } } diff --git a/commands/minigame/rps.js b/commands/minigame/rps.js index 60f9f01..c8d05fb 100644 --- a/commands/minigame/rps.js +++ b/commands/minigame/rps.js @@ -28,34 +28,34 @@ class rpsCommand extends Command { switch (playerHand) { case 'rock': if (pcHand==1) { - message.channel.send('You both chose rock!'); + message.reply('You both chose rock!'); } else if (pcHand==2) { - message.channel.send('The bot chose paper, you lose!'); + message.reply('The bot chose paper, you lose!'); } else { - message.channel.send('The bot chose scissors, you win!'); + message.reply('The bot chose scissors, you win!'); } break; case 'paper': if (pcHand==1) { - message.channel.send('You both chose paper!'); + message.reply('You both chose paper!'); } else if (pcHand==2) { - message.channel.send('The bot chose scissors, you lose!'); + message.reply('The bot chose scissors, you lose!'); } else { - message.channel.send('The bot chose rock, you win!'); + message.reply('The bot chose rock, you win!'); } break; case 'scissors': if (pcHand==1) { - message.channel.send('You both chose scissors!'); + message.reply('You both chose scissors!'); } else if (pcHand==2) { - message.channel.send('The bot chose rock, you lose!'); + message.reply('The bot chose rock, you lose!'); } else { - message.channel.send('The bot chose paper, you win!'); + message.reply('The bot chose paper, you win!'); } break; default: - message.channel.send(`You entered ${playerHand} which is an incorrect choice.`); + message.reply(`You entered ${playerHand} which is an incorrect choice. Try again with rock, paper or scissors`); break; } diff --git a/commands/utility/about.js b/commands/utility/about.js index dfed68b..d012b6c 100644 --- a/commands/utility/about.js +++ b/commands/utility/about.js @@ -52,7 +52,7 @@ class aboutCommand extends Command { .setThumbnail('https://its.gamingti.me/ZiRe.png') .setFooter(`Original bot made by ${this.client.users.resolve('267065637183029248').tag} (267065637183029248)`); // Please this line - message.channel.send(aboutEmbed); + message.reply(aboutEmbed); }); } } diff --git a/commands/utility/avatar.js b/commands/utility/avatar.js index 3310bcc..19b382b 100644 --- a/commands/utility/avatar.js +++ b/commands/utility/avatar.js @@ -38,7 +38,7 @@ class AvatarCommand extends Command { avatarEmbed.setDescription(`[png](${message.author.displayAvatarURL({ format: 'png', size: 2048 })}) | [jpeg](${message.author.displayAvatarURL({ format: 'jpg', size: 2048 })}) | [webp](${message.author.displayAvatarURL({ format: 'webp', size: 2048 })})`); avatarEmbed.setImage(message.author.displayAvatarURL({ format: 'png', size: 2048 })); } - return message.channel.send({embed: avatarEmbed}); + return message.reply({embed: avatarEmbed}); } else { let format = args.user.displayAvatarURL({ dynamic: true }).substr(args.user.displayAvatarURL({ dynamic: true }).length - 3); console.log(format); @@ -51,7 +51,7 @@ class AvatarCommand extends Command { avatarEmbed.setDescription(`[png](${args.user.displayAvatarURL({ format: 'png', size: 2048 })}) | [jpeg](${args.user.displayAvatarURL({ format: 'jpg', size: 2048 })}) | [webp](${args.user.displayAvatarURL({ format: 'webp', size: 2048 })})`); avatarEmbed.setImage(args.user.displayAvatarURL({ format: 'png', size: 2048 })); } - return message.channel.send({embed: avatarEmbed}); + return message.reply({embed: avatarEmbed}); } } } diff --git a/commands/utility/donate.js b/commands/utility/donate.js index fa369d2..530a945 100644 --- a/commands/utility/donate.js +++ b/commands/utility/donate.js @@ -16,7 +16,7 @@ class donateCommand extends Command { } async exec(message) { - if (donations === undefined) return message.channel.send('No donations has been setup on that bot.'); + if (donations === undefined) return message.reply('No donations has been setup on that bot.'); let desc = 'If you decide to donate, please use the feedback command to let the owner know about it so he can put you in the about and donator command.'; @@ -29,7 +29,7 @@ class donateCommand extends Command { .setTitle('Donation link') .setDescription(desc); - return message.channel.send(Embed); + return message.reply(Embed); } } diff --git a/commands/utility/donator.js b/commands/utility/donator.js index f5cebd3..3b4d61d 100644 --- a/commands/utility/donator.js +++ b/commands/utility/donator.js @@ -32,7 +32,7 @@ class donatorCommand extends Command { donatorMessage += 'No one :('; } - return message.channel.send(donatorMessage); + return message.reply(donatorMessage); } } diff --git a/commands/utility/feedback.js b/commands/utility/feedback.js index b12dc26..a6afa1a 100644 --- a/commands/utility/feedback.js +++ b/commands/utility/feedback.js @@ -47,7 +47,7 @@ class FeedbackCommand extends Command { // Don't let new account use this command to prevent spam, if they have an UUID its fine to skip it let date = new Date(); if (message.author.createdAt > date.setDate(date.getDate() - 7)) { - return message.channel.send('Your account is too new to be able to use this command!'); + return message.reply('Your account is too new to be able to use this command!'); } const channel = this.client.channels.resolve(feedbackChannel); @@ -58,7 +58,7 @@ class FeedbackCommand extends Command { channel.send({embed: Embed}); - message.channel.send('Your feedback has been sent! Don\'t forget to have dm open if you want to get an answer from the dev!'); + message.reply('Your feedback has been sent! Don\'t forget to have dm open if you want to get an answer from the dev!'); } } diff --git a/commands/utility/server.js b/commands/utility/server.js index c57f109..5871d9a 100644 --- a/commands/utility/server.js +++ b/commands/utility/server.js @@ -36,7 +36,7 @@ class ServerCommand extends Command { if (logStats) addEmbed.addField('Logging', 'On ✅'); else addEmbed.addField('Logging', 'Off ❌'); - message.channel.send({ embed: addEmbed }); + message.reply({ embed: addEmbed }); } } diff --git a/commands/utility/serverIcon.js b/commands/utility/serverIcon.js index 1dd1752..2d19cee 100644 --- a/commands/utility/serverIcon.js +++ b/commands/utility/serverIcon.js @@ -38,7 +38,7 @@ class serverIconCommand extends Command { serverEmbed.setDescription(`[png](${message.guild.iconURL({ format: 'png', size: 2048 })}) | [jpeg](${message.guild.iconURL({ format: 'jpg', size: 2048 })}) | [webp](${message.guild.iconURL({ format: 'webp', size: 2048 })})`); serverEmbed.setImage(message.guild.iconURL({ format: 'png', size: 2048 })); } - return message.channel.send({embed: serverEmbed}); + return message.reply({embed: serverEmbed}); } else { let format = this.client.guilds.find(guild => guild.id == args.serverid).iconURL().substr(this.client.guilds.find(guild => guild.id == args.serverid).iconURL().length - 3); if (format == 'gif') { @@ -50,7 +50,7 @@ class serverIconCommand extends Command { serverEmbed.setDescription(`[png](${this.client.guilds.find(guild => guild.id == args.serverid).iconURL({ format: 'png', size: 2048 })}) | [jpeg](${this.client.guilds.find(guild => guild.id == args.serverid).iconURL({ format: 'jpg', size: 2048 })}) | [webp](${this.client.guilds.find(guild => guild.id == args.serverid).iconURL({ format: 'webp', size: 2048 })})`); serverEmbed.setImage(this.client.guilds.find(guild => guild.id == args.serverid).iconURL({ format: 'png', size: 2048 })); } - return message.channel.send({embed: serverEmbed}); + return message.reply({embed: serverEmbed}); } } } diff --git a/commands/utility/stats.js b/commands/utility/stats.js index dced2ec..44b83e4 100644 --- a/commands/utility/stats.js +++ b/commands/utility/stats.js @@ -58,7 +58,7 @@ class StatsCommand extends Command { .addField('Discord-Akairo version', akairoVersion, true) .setTimestamp(); - return message.channel.send(statsEmbed); + return message.reply(statsEmbed); } } diff --git a/commands/utility/updoot.js b/commands/utility/updoot.js index 2d7f430..4c589c5 100644 --- a/commands/utility/updoot.js +++ b/commands/utility/updoot.js @@ -26,7 +26,7 @@ class UpdootCommand extends Command { .setTimestamp() .setFooter('Thanks for the updoots', this.client.user.avatarURL); - message.channel.send({ embed: upDoot }); + message.reply({ embed: upDoot }); } } diff --git a/commands/utility/userInfo.js b/commands/utility/userInfo.js index 5aa38b2..92c0bf4 100644 --- a/commands/utility/userInfo.js +++ b/commands/utility/userInfo.js @@ -28,7 +28,7 @@ class userInfoCommand extends Command { user = args.user; } - let member = message.guild.member(user); + let member = await message.guild.members.fetch(user); const Embed = this.client.util.embed() .setColor(member ? member.displayHexColor : 'NAVY') .setAuthor(`${user.tag} (${user.id})`, user.displayAvatarURL()) @@ -69,7 +69,7 @@ class userInfoCommand extends Command { if (member.roles) Embed.addField('Roles', `${member.roles.cache.array().join(', ')}`); } - return message.channel.send({ embed: Embed }); + return message.reply({ embed: Embed }); } } diff --git a/commands/utility/wallpaper.js b/commands/utility/wallpaper.js index 7218a8d..9c04b18 100644 --- a/commands/utility/wallpaper.js +++ b/commands/utility/wallpaper.js @@ -25,7 +25,7 @@ class wallpaperCommand extends Command { async exec(message, args) { let mkt = args.region; if (!args.region) mkt = 'en-US'; - if (!['zh-CN', 'en-US', 'ja-JP', 'en-AU', 'en-UK', 'de-DE', 'en-NZ', 'en-CA'].includes(mkt)) return message.channel.send('Please choose a valid region settings: zh-CN, en-US, ja-JP, en-AU, en-UK, de-DE, en-NZ, en-CA'); + if (!['zh-CN', 'en-US', 'ja-JP', 'en-AU', 'en-UK', 'de-DE', 'en-NZ', 'en-CA'].includes(mkt)) return message.reply('Please choose a valid region settings: zh-CN, en-US, ja-JP, en-AU, en-UK, de-DE, en-NZ, en-CA'); fetch(`https://bing.biturl.top/?mkt=${mkt}`) .then(res => { return res.json(); @@ -38,7 +38,7 @@ class wallpaperCommand extends Command { .setDescription(`[1366](https://bing.biturl.top/?resolution=1366&format=image&mkt=${mkt}) | [1920](https://bing.biturl.top/?resolution=1920&format=image&mkt=${mkt})`) .setImage(res.url); - return message.channel.send(wallpaperEmbed); + return message.reply(wallpaperEmbed); }); } } diff --git a/event/listeners/message.js b/event/listeners/message.js index ca73618..b750f9f 100644 --- a/event/listeners/message.js +++ b/event/listeners/message.js @@ -21,6 +21,8 @@ class messageListener extends Listener { } async exec(message) { + if (message.author.bot) return; + const blacklist = await userBlacklist.findOne({where: {userID:message.author.id}}); if (blacklist) return; @@ -34,7 +36,6 @@ class messageListener extends Listener { await message.guild.members.fetch(); - if (message.author.bot) return; /* Banned words section * @@ -87,7 +88,7 @@ class messageListener extends Listener { if (message.guild) { const autoresponseStat = await autoResponseStat.findOne({where: {serverID: message.guild.id, stat: 'enable'}}); if (autoresponseStat) { - // Infinit haha very yes + // Infinite haha very yes if (message.content.toLowerCase().startsWith('haha very') && message.content.toLowerCase().endsWith('yes')) { let yes = message.content.toLowerCase().replace('haha', ''); yes = yes.replace('yes', '');