diff --git a/commands/avataredit/3000years.js b/commands/avataredit/3000years.js index 088eec36..a9f01569 100644 --- a/commands/avataredit/3000years.js +++ b/commands/avataredit/3000years.js @@ -25,14 +25,14 @@ module.exports = class YearsCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'ATTACH_FILES'])) return; } console.log(`[Command] ${message.content}`); - let user = args.user; + const user = args.user; let userAvatar = user.displayAvatarURL; userAvatar = userAvatar.replace(".jpg", ".png"); userAvatar = userAvatar.replace(".gif", ".png"); let images = []; images.push(Jimp.read(userAvatar)); images.push(Jimp.read("./images/3000years.png")); - let [avatar, years] = await Promise.all(images); + const [avatar, years] = await Promise.all(images); avatar.resize(200, 200); years.blit(avatar, 461, 127); years.getBuffer(Jimp.MIME_PNG, (err, buff) => { diff --git a/commands/avataredit/beautiful.js b/commands/avataredit/beautiful.js index d2857eea..67a6a46b 100644 --- a/commands/avataredit/beautiful.js +++ b/commands/avataredit/beautiful.js @@ -25,14 +25,14 @@ module.exports = class BeautifulCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'ATTACH_FILES'])) return; } console.log(`[Command] ${message.content}`); - let user = args.user; + const user = args.user; let userAvatar = user.displayAvatarURL; userAvatar = userAvatar.replace(".jpg", ".png"); userAvatar = userAvatar.replace(".gif", ".png"); let images = []; images.push(Jimp.read(userAvatar)); images.push(Jimp.read("./images/beautiful.jpg")); - let [avatar, beautiful] = await Promise.all(images); + const [avatar, beautiful] = await Promise.all(images); avatar.resize(200, 200); beautiful.blit(avatar, 432, 42); avatar.resize(190, 190); diff --git a/commands/avataredit/bobross.js b/commands/avataredit/bobross.js index 86405ac9..d62ff448 100644 --- a/commands/avataredit/bobross.js +++ b/commands/avataredit/bobross.js @@ -26,7 +26,7 @@ module.exports = class BobRossCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'ATTACH_FILES'])) return; } console.log(`[Command] ${message.content}`); - let user = args.user; + const user = args.user; let userAvatar = user.displayAvatarURL; userAvatar = userAvatar.replace(".jpg", ".png"); userAvatar = userAvatar.replace(".gif", ".png"); @@ -34,7 +34,7 @@ module.exports = class BobRossCommand extends commando.Command { images.push(Jimp.read(userAvatar)); images.push(Jimp.read("./images/BobRoss.png")); images.push(Jimp.read("./images/BlankWhite.png")); - let [avatar, bob, nothing] = await Promise.all(images); + const [avatar, bob, nothing] = await Promise.all(images); avatar.rotate(2); avatar.resize(300, 300); nothing.composite(avatar, 44, 85); diff --git a/commands/avataredit/rip.js b/commands/avataredit/rip.js index 7a7d4aba..6d9752d5 100644 --- a/commands/avataredit/rip.js +++ b/commands/avataredit/rip.js @@ -26,14 +26,14 @@ module.exports = class RIPCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'ATTACH_FILES'])) return; } console.log(`[Command] ${message.content}`); - let user = args.user; + const user = args.user; let userAvatar = user.displayAvatarURL; userAvatar = userAvatar.replace(".jpg", ".png"); userAvatar = userAvatar.replace(".gif", ".png"); let images = []; images.push(Jimp.read(userAvatar)); images.push(Jimp.read("./images/gravestone.jpg")); - let [avatar, gravestone] = await Promise.all(images); + const [avatar, gravestone] = await Promise.all(images); avatar.resize(200, 200); gravestone.blit(avatar, 60, 65); gravestone.getBuffer(Jimp.MIME_PNG, (err, buff) => { diff --git a/commands/avataredit/steamcard.js b/commands/avataredit/steamcard.js index fcd98036..3e27b2e6 100644 --- a/commands/avataredit/steamcard.js +++ b/commands/avataredit/steamcard.js @@ -26,8 +26,8 @@ module.exports = class SteamCardCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'ATTACH_FILES'])) return; } console.log(`[Command] ${message.content}`); - let user = args.user; - let userDisplayName = message.guild.member(args.user).displayName; + const user = args.user; + const userDisplayName = message.guild.member(args.user).displayName; let userAvatar = user.displayAvatarURL; userAvatar = userAvatar.replace(".jpg", ".png"); userAvatar = userAvatar.replace(".gif", ".png"); @@ -35,8 +35,8 @@ module.exports = class SteamCardCommand extends commando.Command { images.push(Jimp.read(userAvatar)); images.push(Jimp.read("./images/SteamCard.png")); images.push(Jimp.read("./images/SteamCardBlank.png")); - let [avatar, steamcard, nothing] = await Promise.all(images); - let font = await Jimp.loadFont(Jimp.FONT_SANS_32_WHITE); + const [avatar, steamcard, nothing] = await Promise.all(images); + const font = await Jimp.loadFont(Jimp.FONT_SANS_32_WHITE); avatar.resize(450, 450); nothing.composite(avatar, 25, 25); nothing.composite(steamcard, 0, 0); diff --git a/commands/botinfo/contact.js b/commands/botinfo/contact.js index b717d775..50fcdd63 100644 --- a/commands/botinfo/contact.js +++ b/commands/botinfo/contact.js @@ -27,9 +27,9 @@ module.exports = class ContactCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let messageToReport = args.report; - let reportedMsg = await this.client.users.get(config.owner).send(`**${message.author.username}#${message.author.discriminator} (${message.author.id}):**\n${messageToReport}`); - let successMsg = await message.say('Message Sent! Thanks for your support!'); + const messageToReport = args.report; + const reportedMsg = await this.client.users.get(config.owner).send(`**${message.author.username}#${message.author.discriminator} (${message.author.id}):**\n${messageToReport}`); + const successMsg = await message.say('Message Sent! Thanks for your support!'); return [reportedMsg, successMsg]; } }; diff --git a/commands/botinfo/info.js b/commands/botinfo/info.js index fa7b9b32..2a3780b5 100644 --- a/commands/botinfo/info.js +++ b/commands/botinfo/info.js @@ -24,8 +24,8 @@ module.exports = class InfoCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let guilds = await this.client.shard.fetchClientValues('guilds.size'); - let vCConnections = await this.client.shard.fetchClientValues('voiceConnections.size'); + const guilds = await this.client.shard.fetchClientValues('guilds.size'); + const vCConnections = await this.client.shard.fetchClientValues('voiceConnections.size'); const embed = new Discord.RichEmbed() .setTitle('Welcome to XiaoBot!') .setAuthor(this.client.user.username, this.client.user.avatarURL) @@ -57,11 +57,9 @@ module.exports = class InfoCommand extends commando.Command { .addField('Library', "[discord.js](https://discord.js.org/#/) / [commando](https://github.com/Gawdl3y/discord.js-commando)", true) .addField('Modules', - "[pirate-speak](https://github.com/mikewesthad/pirate-speak), [google-translate-api](https://github.com/matheuss/google-translate-api), [zalgoize](https://github.com/clux/zalgolize), [hepburn](https://github.com/lovell/hepburn), [string-to-binary](https://www.npmjs.com/package/string-to-binary), [roman-numeral-converter-mmxvi](https://github.com/Cein-Markey/roman-numeral-conversion-library), [cowsay](https://github.com/piuccio/cowsay), [morse](https://github.com/ecto/morse)") - .addField('Utility Modules', - "[superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [opusscript](https://github.com/abalabahaha/opusscript), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/), [sherlockjs](https://github.com/maytis/sherlockjs)") + "[pirate-speak](https://github.com/mikewesthad/pirate-speak), [google-translate-api](https://github.com/matheuss/google-translate-api), [zalgoize](https://github.com/clux/zalgolize), [hepburn](https://github.com/lovell/hepburn), [string-to-binary](https://www.npmjs.com/package/string-to-binary), [roman-numeral-converter-mmxvi](https://github.com/Cein-Markey/roman-numeral-conversion-library), [cowsay](https://github.com/piuccio/cowsay), [morse](https://github.com/ecto/morse), [superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [opusscript](https://github.com/abalabahaha/opusscript), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/), [sherlockjs](https://github.com/maytis/sherlockjs)") .addField('APIs', - "[Wattpad API](https://developer.wattpad.com/docs/api), [Wordnik API](http://developer.wordnik.com/docs.html), [osu! API](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices API](http://docs.yugiohprices.apiary.io/#), [YouTube Data API](https://developers.google.com/youtube/v3/), [Yoda Speak API](https://market.mashape.com/ismaelc/yoda-speak), [Discord Bots API](https://bots.discord.pw/api), [Today in History API](http://history.muffinlabs.com/#api), [jService API](http://jservice.io/), [Strawpoll API](https://github.com/strawpoll/strawpoll/wiki/API), [Urban Dictionary API](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB API](http://www.omdbapi.com/), [Yahoo Weather API](https://developer.yahoo.com/weather/)") + "[Wattpad API](https://developer.wattpad.com/docs/api), [Wordnik API](http://developer.wordnik.com/docs.html), [osu! API](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices API](http://docs.yugiohprices.apiary.io/#), [YouTube Data API](https://developers.google.com/youtube/v3/), [Yoda Speak API](https://market.mashape.com/ismaelc/yoda-speak), [Discord Bots API](https://bots.discord.pw/api), [Today in History API](http://history.muffinlabs.com/#api), [jService API](http://jservice.io/), [Strawpoll API](https://github.com/strawpoll/strawpoll/wiki/API), [Urban Dictionary API](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB API](http://www.omdbapi.com/), [Yahoo Weather API](https://developer.yahoo.com/weather/), [iTunes Store Search API](https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/)") .addField('Other Credit', "[Heroku](https://www.heroku.com/), [Cloud9](https://c9.io/), [heroku-buildpack-ffmpeg-latest](https://elements.heroku.com/buildpacks/jonathanong/heroku-buildpack-ffmpeg-latest)") .addField('My Server', diff --git a/commands/games/lottery.js b/commands/games/lottery.js index 5dc81ed8..52352b85 100644 --- a/commands/games/lottery.js +++ b/commands/games/lottery.js @@ -16,7 +16,7 @@ module.exports = class LotteryCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let lotteryNumber = ['Winner'][Math.floor(Math.random() * 100)]; + const lotteryNumber = ['Winner'][Math.floor(Math.random() * 100)]; if (lotteryNumber !== "Winner") return message.say(`Nope, sorry ${message.author.username}, you lost.`); return message.say(`Wow ${message.author.username}! You actually won! Great job!`); } diff --git a/commands/games/mathgame.js b/commands/games/mathgame.js index b1c66d49..5256bc26 100644 --- a/commands/games/mathgame.js +++ b/commands/games/mathgame.js @@ -29,7 +29,7 @@ module.exports = class MathGameCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let level = args.difficulty.toLowerCase(); + const level = args.difficulty.toLowerCase(); let randomType = ['+', '-', '*']; randomType = randomType[Math.floor(Math.random() * randomType.length)]; let randomValue; @@ -47,29 +47,29 @@ module.exports = class MathGameCommand extends commando.Command { randomValue = 1000; break; } - let randomValue1 = Math.floor(Math.random() * randomValue) + 1; - let randomValue2 = Math.floor(Math.random() * randomValue) + 1; - let randomExpression = randomValue1 + randomType + randomValue2; - let solved = math.eval(randomExpression); + const randomValue1 = Math.floor(Math.random() * randomValue) + 1; + const randomValue2 = Math.floor(Math.random() * randomValue) + 1; + const randomExpression = randomValue1 + randomType + randomValue2; + const solved = math.eval(randomExpression); const embed = new Discord.RichEmbed() .setTitle('You have **ten** seconds to answer:') .setDescription(randomExpression); - let embedMsg = await message.embed(embed); + const embedMsg = await message.embed(embed); try { - let collected = await message.channel.awaitMessages(response => response.author.id === message.author.id, { + const collected = await message.channel.awaitMessages(response => response.author.id === message.author.id, { max: 1, time: 10000, errors: ['time'] }); if (collected.first().content !== solved.toString()) { - let loseMsg = await message.say(`Aw... Too bad, try again next time!\nThe correct answer is: ${solved}`); + const loseMsg = await message.say(`Aw... Too bad, try again next time!\nThe correct answer is: ${solved}`); return [embedMsg, loseMsg]; } - let victoryMsg = await message.say(`Good Job! You won! ${solved} is the correct answer!`); + const victoryMsg = await message.say(`Good Job! You won! ${solved} is the correct answer!`); return [embedMsg, victoryMsg]; } catch (err) { - let loseMsg = await message.say(`Aw... Too bad, try again next time!\nThe correct answer is: ${solved}`); + const loseMsg = await message.say(`Aw... Too bad, try again next time!\nThe correct answer is: ${solved}`); return [embedMsg, loseMsg]; } } diff --git a/commands/games/quiz.js b/commands/games/quiz.js index da8f777a..599f7a00 100644 --- a/commands/games/quiz.js +++ b/commands/games/quiz.js @@ -22,32 +22,32 @@ module.exports = class QuizCommand extends commando.Command { } console.log("[Command] " + message.content); try { - let response = await request + const response = await request .get('http://jservice.io/api/random') .query({ count: 1 }); - let data = response.body[0]; - let answer = data.answer.toLowerCase().split("").join("").split("").join(""); + const data = response.body[0]; + const answer = data.answer.toLowerCase().split("").join("").split("").join(""); const embed = new Discord.RichEmbed() .setTitle('You have **fifteen** seconds to answer this question:') .setDescription(`**Category: ${data.category.title}**\n${data.question}`); - let embedMsg = await message.embed(embed); + const embedMsg = await message.embed(embed); try { - let collected = await message.channel.awaitMessages(res => res.author.id === message.author.id, { + const collected = await message.channel.awaitMessages(res => res.author.id === message.author.id, { max: 1, time: 15000, errors: ['time'] }); if (collected.first().content.toLowerCase() !== answer) { - let loseMsg = await message.say(`The correct answer is: ${answer}`); + const loseMsg = await message.say(`The correct answer is: ${answer}`); return [embedMsg, loseMsg]; } - let victoryMsg = await message.say(`The correct answer is: ${answer}`); + const victoryMsg = await message.say(`The correct answer is: ${answer}`); return [embedMsg, victoryMsg]; } catch (err) { - let loseMsg = await message.say(`Aw... Too bad, try again next time!\nThe Correct Answer was: ${answer}`); + const loseMsg = await message.say(`Aw... Too bad, try again next time!\nThe Correct Answer was: ${answer}`); return [embedMsg, loseMsg]; } } diff --git a/commands/games/rockpaperscissors.js b/commands/games/rockpaperscissors.js index f936a334..3304e8cc 100644 --- a/commands/games/rockpaperscissors.js +++ b/commands/games/rockpaperscissors.js @@ -30,7 +30,7 @@ module.exports = class RockPaperScissors extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let rps = args.choice.toLowerCase(); + const rps = args.choice.toLowerCase(); let response = ['Paper', 'Rock', 'Scissors']; response = response[Math.floor(Math.random() * response.length)]; if (rps === "rock") { diff --git a/commands/games/slots.js b/commands/games/slots.js index 131932c9..2a6dada3 100644 --- a/commands/games/slots.js +++ b/commands/games/slots.js @@ -16,11 +16,11 @@ module.exports = class SlotsCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let slotThing = [':grapes:', ':tangerine:', ':pear:', ':cherries:']; - let slotOne = slotThing[Math.floor(Math.random() * slotThing.length)]; - let slotTwo = slotThing[Math.floor(Math.random() * slotThing.length)]; - let slotThree = slotThing[Math.floor(Math.random() * slotThing.length)]; - let slotFour = slotThing[Math.floor(Math.random() * slotThing.length)]; + const slotThing = [':grapes:', ':tangerine:', ':pear:', ':cherries:']; + const slotOne = slotThing[Math.floor(Math.random() * slotThing.length)]; + const slotTwo = slotThing[Math.floor(Math.random() * slotThing.length)]; + const slotThree = slotThing[Math.floor(Math.random() * slotThing.length)]; + const slotFour = slotThing[Math.floor(Math.random() * slotThing.length)]; if (slotOne === slotTwo && slotOne === slotThree && slotOne === slotFour) { return message.say(`${slotOne}|${slotTwo}|${slotThree}|${slotFour}\nWow! You won! Great job... er... luck!`); } diff --git a/commands/games/typinggame.js b/commands/games/typinggame.js index 04bdfdcb..b984c4f8 100644 --- a/commands/games/typinggame.js +++ b/commands/games/typinggame.js @@ -28,7 +28,7 @@ module.exports = class TypingGameCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let level = args.difficulty.toLowerCase(); + const level = args.difficulty.toLowerCase(); let randomSentence = ['The quick brown fox jumps over the lazy dog.', 'Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.', 'How razorback-jumping frogs can level six piqued gymnasts!', 'Amazingly few discotheques provide jukeboxes.']; randomSentence = randomSentence[Math.floor(Math.random() * randomSentence.length)]; let time; @@ -54,22 +54,22 @@ module.exports = class TypingGameCommand extends commando.Command { const embed = new Discord.RichEmbed() .setTitle(`You have **${levelWord}** seconds to type:`) .setDescription(randomSentence); - let embedMsg = await message.embed(embed); + const embedMsg = await message.embed(embed); try { - let collected = await message.channel.awaitMessages(response => response.author.id === message.author.id, { + const collected = await message.channel.awaitMessages(response => response.author.id === message.author.id, { max: 1, time: time, errors: ['time'] }); if (collected.first().content !== randomSentence) { - let loseMsg = await message.say('Nope, your sentence does not match the original. Try again next time!'); + const loseMsg = await message.say('Nope, your sentence does not match the original. Try again next time!'); return [embedMsg, loseMsg]; } - let victoryMsg = await message.say(`Good Job! You won!`); + const victoryMsg = await message.say(`Good Job! You won!`); return [embedMsg, victoryMsg]; } catch (err) { - let loseMsg = await message.say('Aw... Too bad, try again next time!'); + const loseMsg = await message.say('Aw... Too bad, try again next time!'); return [embedMsg, loseMsg]; } } diff --git a/commands/imageedit/meme.js b/commands/imageedit/meme.js index f809ef56..37f67d8b 100644 --- a/commands/imageedit/meme.js +++ b/commands/imageedit/meme.js @@ -42,12 +42,12 @@ module.exports = class MemeCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'ATTACH_FILES'])) return; } console.log(`[Command] ${message.content}`); - let type = args.type.toLowerCase(); - let content = args.content; - let memeQuery = content.split(" ").join("-").split("-|-"); - let toprow = memeQuery[0].split("?").join("~q"); - let bottomrow = memeQuery[1].split("?").join("~q"); - let link = `https://memegen.link/${type}/${toprow}/${bottomrow}.jpg`; + const type = args.type.toLowerCase(); + const content = args.content; + const memeQuery = content.split(" ").join("-").split("-|-"); + const toprow = memeQuery[0].split("?").join("~q"); + const bottomrow = memeQuery[1].split("?").join("~q"); + const link = `https://memegen.link/${type}/${toprow}/${bottomrow}.jpg`; if (bottomrow.length > 100) return message.say(":x: Error! Bottom text is over 100 characters!"); if (toprow.length > 100) return message.say(":x: Error! Top text is over 100 characters!"); return message.channel.sendFile(link).catch(err => message.say(':x: Error! Something went wrong!')); diff --git a/commands/moderation/ban.js b/commands/moderation/ban.js index 9df22803..a2bef6c6 100644 --- a/commands/moderation/ban.js +++ b/commands/moderation/ban.js @@ -40,19 +40,19 @@ module.exports = class BanCommand extends commando.Command { } console.log(`[Command] ${message.content}`); if (!message.guild.channels.exists("name", "mod_logs")) return message.say(":x: Error! Could not find the mod_logs channel! Please create it!"); - let member = args.member; - let reason = args.reason; + const member = args.member; + const reason = args.reason; if (!message.guild.member(member).bannable) return message.say(":x: Error! This member cannot be banned! Perhaps they have a higher role than me?"); try { - let banUser = await message.guild.member(member).ban(); - let okHandMsg = await message.say(":ok_hand:"); + const banUser = await message.guild.member(member).ban(); + const okHandMsg = await message.say(":ok_hand:"); const embed = new Discord.RichEmbed() .setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL) .setColor(0xFF0000) .setFooter('XiaoBot Moderation', this.client.user.avatarURL) .setTimestamp() .setDescription(`**Member:** ${banUser.user.username}#${banUser.user.discriminator} (${member.id})\n**Action:** Ban\n**Reason:** ${reason}`); - let modLogMsg = await message.guild.channels.find('name', 'mod_logs').sendEmbed(embed); + const modLogMsg = await message.guild.channels.find('name', 'mod_logs').sendEmbed(embed); return [banUser, okHandMsg, modLogMsg]; } catch (err) { diff --git a/commands/moderation/kick.js b/commands/moderation/kick.js index 27ee836d..850f02c2 100644 --- a/commands/moderation/kick.js +++ b/commands/moderation/kick.js @@ -37,19 +37,19 @@ module.exports = class KickCommand extends commando.Command { } console.log(`[Command] ${message.content}`); if (!message.guild.channels.exists("name", "mod_logs")) return message.say(":x: Error! Could not find the mod_logs channel! Please create it!"); - let member = args.member; - let reason = args.reason; + const member = args.member; + const reason = args.reason; if (!message.guild.member(member).bannable) return message.say(":x: Error! This member cannot be kicked! Perhaps they have a higher role than me?"); try { - let kickUser = await message.guild.member(member).kick(); - let okHandMsg = await message.say(":ok_hand:"); + const kickUser = await message.guild.member(member).kick(); + const okHandMsg = await message.say(":ok_hand:"); const embed = new Discord.RichEmbed() .setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL) .setColor(0xFFA500) .setFooter('XiaoBot Moderation', this.client.user.avatarURL) .setTimestamp() .setDescription(`**Member:** ${kickUser.user.username}#${kickUser.user.discriminator} (${member.id})\n**Action:** Kick\n**Reason:** ${reason}`); - let modLogMsg = await message.guild.channels.find('name', 'mod_logs').sendEmbed(embed); + const modLogMsg = await message.guild.channels.find('name', 'mod_logs').sendEmbed(embed); return [kickUser, okHandMsg, modLogMsg]; } catch (err) { diff --git a/commands/moderation/lockdown.js b/commands/moderation/lockdown.js index 114b3b7b..e37ec534 100644 --- a/commands/moderation/lockdown.js +++ b/commands/moderation/lockdown.js @@ -32,7 +32,7 @@ module.exports = class LockdownCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission('MANAGE_CHANNELS')) return message.say(":x: Error! I don't have permission to Manage Channels!"); } console.log(`[Command] ${message.content}`); - let type = args.type; + const type = args.type; if (type.toLowerCase() === 'start') { try { await message.channel.overwritePermissions(message.guild.defaultRole, { diff --git a/commands/moderation/prune.js b/commands/moderation/prune.js index fe793eb7..45010ec2 100644 --- a/commands/moderation/prune.js +++ b/commands/moderation/prune.js @@ -43,12 +43,13 @@ module.exports = class PruneCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['READ_MESSAGES', 'MANAGE_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let count = args.count + 1; + const count = args.count + 1; try { - let messages = await message.channel.fetchMessages({ + const messages = await message.channel.fetchMessages({ limit: count }); await message.channel.bulkDelete(messages, true); + return null; } catch (err) { return message.say(':x: Error! Something went wrong! Perhaps there are not enough messages in the channel from earlier than two weeks?'); diff --git a/commands/moderation/unban.js b/commands/moderation/unban.js index 16ccc555..b0a1f056 100644 --- a/commands/moderation/unban.js +++ b/commands/moderation/unban.js @@ -46,21 +46,21 @@ module.exports = class UnbanCommand extends commando.Command { } console.log(`[Command] ${message.content}`); if (!message.guild.channels.exists("name", "mod_logs")) return message.say(":x: Error! Could not find the mod_logs channel! Please create it!"); - let memberID = args.memberID; - let reason = args.reason; - let bans = await message.guild.fetchBans(); + const memberID = args.memberID; + const reason = args.reason; + const bans = await message.guild.fetchBans(); if (!bans.has(memberID)) return message.say(':x: Error! Could not find this user in the bans.'); - let unbanUserObj = await bans.get(memberID); + const unbanUserObj = await bans.get(memberID); try { - let unbanUser = await message.guild.unban(unbanUserObj); - let okHandMsg = await message.say(":ok_hand:"); + const unbanUser = await message.guild.unban(unbanUserObj); + const okHandMsg = await message.say(":ok_hand:"); const embed = new Discord.RichEmbed() .setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL) .setColor(0x00AE86) .setFooter('XiaoBot Moderation', this.client.user.avatarURL) .setTimestamp() .setDescription(`**Member:** ${unbanUser.username}#${unbanUser.discriminator} (${unbanUser.id})\n**Action:** Unban\n**Reason:** ${reason}`); - let modLogMsg = await message.guild.channels.find('name', 'mod_logs').sendEmbed(embed); + const modLogMsg = await message.guild.channels.find('name', 'mod_logs').sendEmbed(embed); return [unbanUser, okHandMsg, modLogMsg]; } catch (err) { diff --git a/commands/moderation/warn.js b/commands/moderation/warn.js index daa1372d..16721fdc 100644 --- a/commands/moderation/warn.js +++ b/commands/moderation/warn.js @@ -36,18 +36,18 @@ module.exports = class WarnCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let userToWarn = args.member; - let reason = args.reason; + const userToWarn = args.member; + const reason = args.reason; if (!message.guild.channels.exists("name", "mod_logs")) return message.say(":x: Error! Could not find the mod_logs channel! Please create it!"); try { - let okHandMsg = await message.say(":ok_hand:"); + const okHandMsg = await message.say(":ok_hand:"); const embed = new Discord.RichEmbed() .setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL) .setColor(0xFFFF00) .setFooter('XiaoBot Moderation', this.client.user.avatarURL) .setTimestamp() .setDescription(`**Member:** ${userToWarn.user.username}#${userToWarn.user.discriminator} (${userToWarn.id})\n**Action:** Warn\n**Reason:** ${reason}`); - let modLogMsg = await message.guild.channels.find('name', 'mod_logs').sendEmbed(embed); + const modLogMsg = await message.guild.channels.find('name', 'mod_logs').sendEmbed(embed); return [okHandMsg, modLogMsg]; } catch (err) { diff --git a/commands/numedit/math.js b/commands/numedit/math.js index 161035cf..9a276a9f 100644 --- a/commands/numedit/math.js +++ b/commands/numedit/math.js @@ -28,9 +28,9 @@ module.exports = class MathCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let expression = args.expression; + const expression = args.expression; try { - let solved = math.eval(expression); + const solved = math.eval(expression); return message.say(solved).catch(err => message.say(":x: Error! Invalid statement!")); } catch (err) { diff --git a/commands/numedit/roman.js b/commands/numedit/roman.js index 7c94020c..93150a88 100644 --- a/commands/numedit/roman.js +++ b/commands/numedit/roman.js @@ -28,8 +28,8 @@ module.exports = class RomanCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let numberToRoman = args.number; - let romanInterger = numberToRoman; + const numberToRoman = args.number; + const romanInterger = numberToRoman; return message.say(romanNumeralConverter.getRomanFromInteger(romanInterger)); } }; diff --git a/commands/random/remind.js b/commands/random/remind.js index c0ec8296..a0a322e9 100644 --- a/commands/random/remind.js +++ b/commands/random/remind.js @@ -26,11 +26,11 @@ module.exports = class RemindCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let remindMe = args.remind; + const remindMe = args.remind; try { - let remindTime = sherlock.parse(remindMe); - let time = remindTime.startDate.getTime() - Date.now(); - let preRemind = await message.say(`I will remind you '${remindTime.eventTitle}' ${moment().add(time, 'ms').fromNow()}.`); + const remindTime = sherlock.parse(remindMe); + const time = remindTime.startDate.getTime() - Date.now(); + const preRemind = await message.say(`I will remind you '${remindTime.eventTitle}' ${moment().add(time, 'ms').fromNow()}.`); const remindMessage = await new Promise(resolve => { setTimeout(() => resolve(message.say(`${message.author} you wanted me to remind you of: '${remindTime.eventTitle}'`)), time); }); diff --git a/commands/random/soundboard.js b/commands/random/soundboard.js index d27e78a7..ecdfbd7a 100644 --- a/commands/random/soundboard.js +++ b/commands/random/soundboard.js @@ -1,5 +1,25 @@ const commando = require('discord.js-commando'); -const sounds = require('./sounds.json'); +const sounds = ['cat', 'pikachu', 'vader', 'doh', "it's a trap", 'mario death', 'pokemon center', 'dun dun dun', 'spongebob', 'ugly barnacle', 'woo hoo', 'space', 'glados bird', 'airhorn', 'zelda chest', 'eat my shorts', 'no this is patrick', 'wumbo']; +const paths = { + "cat": "./sounds/cat.mp3", + "pikachu": "./sounds/pikachu.mp3", + "vader": "./sounds/vader.mp3", + "doh": "./sounds/doh.mp3", + "it's a trap": "./sounds/its-a-trap.mp3", + "mario death": "./sounds/mario-death.mp3", + "pokemon center": "./sounds/pokemon-center.mp3", + "dun dun dun": "./sounds/dun-dun-dun.mp3", + "spongebob": "./sounds/spongebob.mp3", + "ugly barnacle": "./sounds/ugly-barnacle.mp3", + "woo hoo": "./sounds/woohoo.mp3", + "space": "./sounds/space.mp3", + "glados bird": "./sounds/glados-bird.mp3", + "airhorn": "./sounds/airhorn.mp3", + "zelda chest": "./sounds/zelda-chest.mp3", + "eat my shorts": "./sounds/eat-my-shorts.mp3", + "no this is patrick": "./sounds/no-this-is-patrick.mp3", + "wumbo": "./sounds/wumbo.mp3" +}; module.exports = class SoundBoardCommand extends commando.Command { constructor(Client) { @@ -20,7 +40,7 @@ module.exports = class SoundBoardCommand extends commando.Command { prompt: 'What sound do you want me to play?', type: 'string', validate: sound => { - if (sounds.avaliable[sound.toLowerCase()]) { + if (sounds.some(soundArray => sound.toLowerCase() === soundArray)) { return true; } return 'Sound not found. Use `;help soundboard` to view a list of sounds.'; @@ -34,17 +54,17 @@ module.exports = class SoundBoardCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'CONNECT', 'SPEAK', 'ADD_REACTIONS'])) return; } console.log(`[Command] ${message.content}`); - let voiceChannel = message.member.voiceChannel; + const voiceChannel = message.member.voiceChannel; if (!voiceChannel) return message.say(`:x: Error! Please be in a voice channel first!`); - let soundToPlay = args.sound.toLowerCase(); - let alreadyConnected = await this.client.voiceConnections.get(voiceChannel.guild.id); + const soundToPlay = args.sound.toLowerCase(); + const alreadyConnected = await this.client.voiceConnections.get(voiceChannel.guild.id); if (alreadyConnected) { if (alreadyConnected.channel.id === voiceChannel.id) return message.say(':x: Error! I am already playing a sound!'); return message.say(':x: Error! I am already playing a sound!'); } - let connection = await voiceChannel.join(); - let stream = sounds.paths[soundToPlay]; - let dispatcher = connection.playStream(stream); + const connection = await voiceChannel.join(); + const stream = paths[soundToPlay]; + const dispatcher = connection.playStream(stream); message.react('🔊'); dispatcher.on('end', () => { message.react('✅'); diff --git a/commands/random/sounds.json b/commands/random/sounds.json deleted file mode 100644 index 97a4eaf7..00000000 --- a/commands/random/sounds.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "avaliable": { - "cat": "cat", - "pikachu": "pikachu", - "vader": "vader", - "doh": "doh", - "it's a trap": "it's a trap", - "mario death": "mario death", - "pokemon center": "pokemon center", - "dun dun dun": "dun dun dun", - "spongebob": "spongebob", - "ugly barnacle": "ugly barnacle", - "woo hoo": "woo hoo", - "space": "space", - "glados bird": "glados bird", - "airhorn": "airhorn", - "zelda chest": "zelda chest", - "eat my shorts": "eat my shorts", - "no this is patrick": "no this is patrick", - "wumbo": "wumbo" - }, - "paths": { - "cat": "./sounds/cat.mp3", - "pikachu": "./sounds/pikachu.mp3", - "vader": "./sounds/vader.mp3", - "doh": "./sounds/doh.mp3", - "it's a trap": "./sounds/its-a-trap.mp3", - "mario death": "./sounds/mario-death.mp3", - "pokemon center": "./sounds/pokemon-center.mp3", - "dun dun dun": "./sounds/dun-dun-dun.mp3", - "spongebob": "./sounds/spongebob.mp3", - "ugly barnacle": "./sounds/ugly-barnacle.mp3", - "woo hoo": "./sounds/woohoo.mp3", - "space": "./sounds/space.mp3", - "glados bird": "./sounds/glados-bird.mp3", - "airhorn": "./sounds/airhorn.mp3", - "zelda chest": "./sounds/zelda-chest.mp3", - "eat my shorts": "./sounds/eat-my-shorts.mp3", - "no this is patrick": "./sounds/no-this-is-patrick.mp3", - "wumbo": "./sounds/wumbo.mp3" - } -} diff --git a/commands/random/strawpoll.js b/commands/random/strawpoll.js index 0f580790..4175c351 100644 --- a/commands/random/strawpoll.js +++ b/commands/random/strawpoll.js @@ -45,18 +45,18 @@ module.exports = class StrawpollCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let title = args.title; - let choices = args.choices.split(" | "); + const title = args.title; + const choices = args.choices.split(" | "); if (choices.length < 2) return message.say(':x: Error! You provided less than two choices!'); if (choices.length > 31) return message.say(':x: Error! You provided more than thirty choices!'); try { - let response = await request + const response = await request .post('https://strawpoll.me/api/v2/polls') .send({ title: title, options: choices }); - let data = response.body; + const data = response.body; return message.say(`${data.title}\nhttp://strawpoll.me/${data.id}`); } catch (err) { diff --git a/commands/random/today.js b/commands/random/today.js index 7aa38063..b4896c61 100644 --- a/commands/random/today.js +++ b/commands/random/today.js @@ -22,15 +22,15 @@ module.exports = class TodayCommand extends commando.Command { } console.log("[Command] " + message.content); try { - let response = await request + const response = await request .get('http://history.muffinlabs.com/date') .set({ 'Accept': 'application/json' }) .buffer(true); - let parsedResponse = JSON.parse(response.text); - let events = parsedResponse.data.Events; - let randomNumber = Math.floor(Math.random() * events.length); + const parsedResponse = JSON.parse(response.text); + const events = parsedResponse.data.Events; + const randomNumber = Math.floor(Math.random() * events.length); const embed = new Discord.RichEmbed() .setColor(0x9797FF) .setURL(parsedResponse.url) diff --git a/commands/response/8ball.js b/commands/response/8ball.js index f7c37ef2..4f8cbbcb 100644 --- a/commands/response/8ball.js +++ b/commands/response/8ball.js @@ -21,7 +21,7 @@ module.exports = class MagicBall extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let question = args.question; + const question = args.question; let answers = ['It seems the answer is yes, yes?', 'It seems the answer is no.', 'It is a little doubtful, yes?', 'It seems it is very likely to be true.']; answers = answers[Math.floor(Math.random() * answers.length)]; return message.say(`Question: ${question}\n:8ball: ${answers} :8ball:`); diff --git a/commands/response/choose.js b/commands/response/choose.js index 3fe904e0..72e91d27 100644 --- a/commands/response/choose.js +++ b/commands/response/choose.js @@ -31,7 +31,6 @@ module.exports = class ChooseCommand extends commando.Command { } console.log(`[Command] ${message.content}`); let choices = args.choices; - if (!choices.includes(' | ')) return message.say(':x: Error! Split your messages with a " | "!'); choices = choices.split(" | "); choices = choices[Math.floor(Math.random() * choices.length)]; return message.say(`I choose ${choices}!`); diff --git a/commands/response/compliment.js b/commands/response/compliment.js index 229e9b3a..243b2130 100644 --- a/commands/response/compliment.js +++ b/commands/response/compliment.js @@ -22,7 +22,7 @@ module.exports = class ComplimentCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToCompliment = args.thing || message.author; + const thingToCompliment = args.thing || message.author; let compliments = ["Your smile is contagious.", "You look great today.", "You're a smart cookie.", "I bet you make babies smile.", "You have impeccable manners.", "I like your style.", "You have the best laugh.", "I appreciate you.", "You are the most perfect you there is.", "You are enough.", "You're strong.", "Your perspective is refreshing.", "You're an awesome friend.", "You light up the room.", "You shine brighter than a shooting star.", "You deserve a hug right now.", "You should be proud of yourself.", "You're more helpful than you realize.", "You have a great sense of humor.", "You've got all the right moves!", "Is that your picture next to 'charming' in the dictionary?", "Your kindness is a balm to all who encounter it.", "You're all that and a super-size bag of chips.", "On a scale from 1 to 10, you're an 11.", "You are brave.", "You're even more beautiful on the inside than you are on the outside.", "You have the courage of your convictions.", "Your eyes are breathtaking.", "If cartoon bluebirds were real, a bunch of them would be sitting on your shoulders singing right now.", "You are making a difference.", "You're like sunshine on a rainy day.", "You bring out the best in other people.", "Your ability to recall random factoids at just the right time is impressive.", "You're a great listener.", "How is it that you always look great, even in sweatpants?", "Everything would be better if more people were like you!", "I bet you sweat glitter.", "You were cool way before hipsters were cool.", "That color is perfect on you.", "Hanging out with you is always a blast.", "You always know -- and say -- exactly what I need to hear when I need to hear it.", "You smell really good.", "You may dance like no one's watching, but everyone's watching because you're an amazing dancer!", "Being around you makes everything better!", "When you say, 'I meant to do that,' I totally believe you.", "When you're not afraid to be yourself is when you're most incredible.", "Colors seem brighter when you're around.", "You're more fun than a ball pit filled with candy. (And seriously, what could be more fun than that?)", "That thing you don't like about yourself is what makes you so interesting.", "You're wonderful.", "You have cute elbows. For reals!", "Jokes are funnier when you tell them.", "You're better than a triple-scoop ice cream cone. With sprinkles.", "Your bellybutton is kind of adorable.", "Your hair looks stunning.", "You're one of a kind!", "You're inspiring.", "If you were a box of crayons, you'd be the giant name-brand one with the built-in sharpener.", "You should be thanked more often. So thank you!!", "Our community is better because you're in it.", "Someone is getting through something hard right now because you've got their back.", "You have the best ideas.", "You always know how to find that silver lining.", "Everyone gets knocked down sometimes, but you always get back up and keep going.", "You're a candle in the darkness.", "You're a great example to others.", "Being around you is like being on a happy little vacation.", "You always know just what to say.", "You're always learning new things and trying to better yourself, which is awesome.", "If someone based an Internet meme on you, it would have impeccable grammar.", "You could survive a Zombie apocalypse.", "You're more fun than bubble wrap.", "When you make a mistake, you fix it.", "Who raised you? They deserve a medal for a job well done.", "You're great at figuring stuff out.", "Your voice is magnificent.", "The people you love are lucky to have you in their lives.", "You're like a breath of fresh air.", "You're gorgeous -- and that's the least interesting thing about you, too.", "You're so thoughtful.", "Your creative potential seems limitless.", "Your name suits you to a T.", "You're irresistible when you blush.", "Actions speak louder than words, and yours tell an incredible story.", "Somehow you make time stop and fly at the same time.", "When you make up your mind about something, nothing stands in your way.", "You seem to really know who you are.", "Any team would be lucky to have you on it.", "In high school I bet you were voted 'most likely to keep being awesome.'", "I bet you do the crossword puzzle in ink.", "Babies and small animals probably love you.", "If you were a scented candle they'd call it Perfectly Imperfect (and it would smell like summer).", "There's ordinary, and then there's you.", "You're someone's reason to smile.", "You're even better than a unicorn, because you're real.", "How do you keep being so funny and making everyone laugh?", "You have a good head on your shoulders.", "Has anyone ever told you that you have great posture?", "The way you treasure your loved ones is incredible.", "You're really something special.", "You're a gift to those around you.", "You don't deserve it."]; compliments = compliments[Math.floor(Math.random() * compliments.length)]; return message.say(`${thingToCompliment}, ${compliments}`); diff --git a/commands/response/motivate.js b/commands/response/motivate.js index e7843086..29d7d090 100644 --- a/commands/response/motivate.js +++ b/commands/response/motivate.js @@ -26,7 +26,7 @@ module.exports = class MotivateCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let userToMotivate = args.thing || message.author; + const userToMotivate = args.thing || message.author; return message.say(`${userToMotivate}, https://www.youtube.com/watch?v=ZXsQAXx_ao0`); } }; diff --git a/commands/response/name.js b/commands/response/name.js index a4da9c9c..197d8647 100644 --- a/commands/response/name.js +++ b/commands/response/name.js @@ -37,7 +37,7 @@ module.exports = class RandomNameGen extends commando.Command { randomFirstFemale = randomFirstFemale[Math.floor(Math.random() * randomFirstFemale.length)]; let randomLast = ["Walker", "Tworni", "Ross", "Smith", "Odendahl", "Deere", "Brown", "Williams", "Jones", "Miles", "Moss", "Roberto", "McFly", "McDonald", "Lewis", "Armstrong", "Stevenson", "Schwarzenegger", "Robinson", "Parker", "Piper", "Johnson", "Brantley", "Stewart", "Ree", "Talbot", "Seville", "Peace", "Spielberg", "Baggins", "Wilborn", "Vankirk", "Shireman", "Jimerson", "Masters", "Hack", "Satcher", "Younkin", "Aguila", "Duffey", "Burgin", "Highfall", "Wee", "Solari", "Tomaselli", "Basler", "Difranco", "Latch", "Rives", "Dolan", "Abraham", "Holter", "Portugal", "Lininger", "Holst", "Mccroy", "Follmer", "Hotchkiss", "Gassaway", "Wang", "Agron", "Raasch", "Gourd", "Czaja", "Marquart", "Papadopoulos", "Ringer", "Lax", "Sperling", "Galusha", "Alston"]; randomLast = randomLast[Math.floor(Math.random() * randomLast.length)]; - let gender = args.gender.toLowerCase(); + const gender = args.gender.toLowerCase(); if (gender === "male") { return message.say(`${randomFirstMale} ${randomLast}`); } diff --git a/commands/response/ratewaifu.js b/commands/response/ratewaifu.js index 21a2391d..df7e38ca 100644 --- a/commands/response/ratewaifu.js +++ b/commands/response/ratewaifu.js @@ -24,8 +24,8 @@ module.exports = class RateWaifuCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let waifuToRate = args.waifu; - let rating = Math.floor(Math.random() * 10) + 1; + const waifuToRate = args.waifu; + const rating = Math.floor(Math.random() * 10) + 1; return message.say(`I'd give ${waifuToRate} a ${rating}/10!`); } }; diff --git a/commands/response/roast.js b/commands/response/roast.js index 77da42c9..3dcddb9a 100644 --- a/commands/response/roast.js +++ b/commands/response/roast.js @@ -25,7 +25,7 @@ module.exports = class RoastMeCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let userToRoast = args.thing || message.author; + const userToRoast = args.thing || message.author; let roasts = ["*puts you in the oven*", "You're so stupid.", "Sorry, I can't hear you over how annoying you are.", "I've got better things to do.", "You're as dumb as Cleverbot.", "Your IQ is lower than the Mariana Trench.", "You're so annoying even the flies stay away from your stench.", "Go away, please.", "I'd give you a nasty look but you've already got one.", "It looks like your face caught fire and someone tried to put it out with a hammer.", "Your family tree must be a cactus because everyone on it is a prick.", "Someday you will go far, and I hope you stay there.", "The zoo called. They're wondering how you got out of your cage.", "I was hoping for a battle of wits, but you appear to be unarmed.", "You are proof that evolution can go in reverse.", "Brains aren't everything, in your case, they're nothing.", "Sorry I didn't get that, I don't speak idiot.", "Why is it acceptable for you to be an idiot, but not for me to point it out?", "We all sprang from apes, but you did not spring far enough.", "You're an unknown command.", "If you could go anywhere I chose, I'd choose dead.", "Even monkeys can go to space, so clearly you lack some potential.", "It's brains over brawn, yet you have neither.", "You look like a monkey, and you smell like one too.", "Even among idiots you're lacking.", "You fail even when you're doing absolutely nothing.", "If there was a vote for 'least likely to succeed' you'd win first prize.", "I'm surrounded by idiots... Or, wait, that's just you.", "I wanna go home. Well, really I just want to get away from the awful aroma you've got going there.", "Every time you touch me I have to go home and wash all my clothes nine times just to get a normal smell back.", "If I had a nickel for every brain you don't have, I'd have one dollar.", "I'd help you succeed but you're incapable."]; roasts = roasts[Math.floor(Math.random() * roasts.length)]; if (!userToRoast) { diff --git a/commands/response/roll.js b/commands/response/roll.js index 575f3529..792e1d63 100644 --- a/commands/response/roll.js +++ b/commands/response/roll.js @@ -26,8 +26,8 @@ module.exports = class RollChooseCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let value = args.number; - let roll = Math.floor(Math.random() * value) + 1; + const value = args.number; + const roll = Math.floor(Math.random() * value) + 1; return message.say(`You rolled a ${roll}.`); } }; diff --git a/commands/response/ship.js b/commands/response/ship.js index d75e4b1d..8fbee166 100644 --- a/commands/response/ship.js +++ b/commands/response/ship.js @@ -24,8 +24,8 @@ module.exports = class ShipCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToShip = args.things; - let percentage = Math.floor(Math.random() * 100) + 1; + const thingToShip = args.things; + const percentage = Math.floor(Math.random() * 100) + 1; return message.say(`I'd give ${thingToShip} a ${percentage}%!`); } }; diff --git a/commands/roleplay/cuddle.js b/commands/roleplay/cuddle.js index f433161c..8f1d3985 100644 --- a/commands/roleplay/cuddle.js +++ b/commands/roleplay/cuddle.js @@ -21,7 +21,7 @@ module.exports = class CuddleCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToRoleplay = args.thing; + const thingToRoleplay = args.thing; return message.say(`${message.author} *cuddles* ${thingToRoleplay}`); } }; diff --git a/commands/roleplay/divorce.js b/commands/roleplay/divorce.js index bed06cb0..f322fc0f 100644 --- a/commands/roleplay/divorce.js +++ b/commands/roleplay/divorce.js @@ -21,7 +21,7 @@ module.exports = class DivorceCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToRoleplay = args.thing; + const thingToRoleplay = args.thing; return message.say(`${message.author} *divorces* ${thingToRoleplay}`); } }; diff --git a/commands/roleplay/eat.js b/commands/roleplay/eat.js index b877b663..790f282b 100644 --- a/commands/roleplay/eat.js +++ b/commands/roleplay/eat.js @@ -21,7 +21,7 @@ module.exports = class EatCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToRoleplay = args.thing; + const thingToRoleplay = args.thing; return message.say(`${message.author} *eats* ${thingToRoleplay}`); } }; diff --git a/commands/roleplay/falconpunch.js b/commands/roleplay/falconpunch.js index dfc04c59..64adf32a 100644 --- a/commands/roleplay/falconpunch.js +++ b/commands/roleplay/falconpunch.js @@ -21,7 +21,7 @@ module.exports = class FalconPunchCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToRoleplay = args.thing; + const thingToRoleplay = args.thing; return message.say(`${message.author} *falcon punches* ${thingToRoleplay}`); } }; diff --git a/commands/roleplay/fistbump.js b/commands/roleplay/fistbump.js index 446e3c36..bbfdc8f2 100644 --- a/commands/roleplay/fistbump.js +++ b/commands/roleplay/fistbump.js @@ -21,7 +21,7 @@ module.exports = class FistBumpCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToRoleplay = args.thing; + const thingToRoleplay = args.thing; return message.say(`${message.author} *fist-bumps* ${thingToRoleplay} *badalalala*`); } }; diff --git a/commands/roleplay/highfive.js b/commands/roleplay/highfive.js index 49d22adb..300341d6 100644 --- a/commands/roleplay/highfive.js +++ b/commands/roleplay/highfive.js @@ -21,7 +21,7 @@ module.exports = class HighFivesCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToRoleplay = args.thing; + const thingToRoleplay = args.thing; return message.say(`${message.author} *high-fives* ${thingToRoleplay}`); } }; diff --git a/commands/roleplay/hitwithshovel.js b/commands/roleplay/hitwithshovel.js index 40515beb..43d23436 100644 --- a/commands/roleplay/hitwithshovel.js +++ b/commands/roleplay/hitwithshovel.js @@ -21,7 +21,7 @@ module.exports = class HitwithShovelCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToRoleplay = args.thing; + const thingToRoleplay = args.thing; return message.say(`${message.author} *hits* ${thingToRoleplay} *with a shovel*`); } }; diff --git a/commands/roleplay/hug.js b/commands/roleplay/hug.js index 13a403d3..c8f03bcf 100644 --- a/commands/roleplay/hug.js +++ b/commands/roleplay/hug.js @@ -21,7 +21,7 @@ module.exports = class HugCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToRoleplay = args.thing; + const thingToRoleplay = args.thing; return message.say(`${message.author} *hugs* ${thingToRoleplay}`); } }; diff --git a/commands/roleplay/inhales.js b/commands/roleplay/inhales.js index 2bb5a585..3594bee1 100644 --- a/commands/roleplay/inhales.js +++ b/commands/roleplay/inhales.js @@ -21,7 +21,7 @@ module.exports = class InhaleCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToRoleplay = args.thing; + const thingToRoleplay = args.thing; return message.say(`${message.author} *inhales* ${thingToRoleplay} *but gained no ability...*`); } }; diff --git a/commands/roleplay/kill.js b/commands/roleplay/kill.js index e6d82558..21ce99b6 100644 --- a/commands/roleplay/kill.js +++ b/commands/roleplay/kill.js @@ -21,7 +21,7 @@ module.exports = class KillCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToRoleplay = args.thing; + const thingToRoleplay = args.thing; return message.say(`${message.author} *kills* ${thingToRoleplay}`); } }; diff --git a/commands/roleplay/kiss.js b/commands/roleplay/kiss.js index 3c2620d4..460c6c83 100644 --- a/commands/roleplay/kiss.js +++ b/commands/roleplay/kiss.js @@ -21,7 +21,7 @@ module.exports = class KissCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToRoleplay = args.thing; + const thingToRoleplay = args.thing; return message.say(`${message.author} *kisses* ${thingToRoleplay}`); } }; diff --git a/commands/roleplay/marries.js b/commands/roleplay/marries.js index 113380c4..92547fae 100644 --- a/commands/roleplay/marries.js +++ b/commands/roleplay/marries.js @@ -21,7 +21,7 @@ module.exports = class MarryCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToRoleplay = args.thing; + const thingToRoleplay = args.thing; return message.say(`${message.author} *marries* ${thingToRoleplay}`); } }; diff --git a/commands/roleplay/pat.js b/commands/roleplay/pat.js index 54a24d02..16056fd7 100644 --- a/commands/roleplay/pat.js +++ b/commands/roleplay/pat.js @@ -21,7 +21,7 @@ module.exports = class PatCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToRoleplay = args.thing; + const thingToRoleplay = args.thing; return message.say(`${message.author} *pats* ${thingToRoleplay}`); } }; diff --git a/commands/roleplay/poke.js b/commands/roleplay/poke.js index 94aec50a..58f67c00 100644 --- a/commands/roleplay/poke.js +++ b/commands/roleplay/poke.js @@ -21,7 +21,7 @@ module.exports = class PokeCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToRoleplay = args.thing; + const thingToRoleplay = args.thing; return message.say(`${message.author} *pokes* ${thingToRoleplay}`); } }; diff --git a/commands/roleplay/punch.js b/commands/roleplay/punch.js index 4a2f4dee..78503c51 100644 --- a/commands/roleplay/punch.js +++ b/commands/roleplay/punch.js @@ -21,7 +21,7 @@ module.exports = class PunchCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToRoleplay = args.thing; + const thingToRoleplay = args.thing; return message.say(`${message.author} *punches* ${thingToRoleplay}`); } }; diff --git a/commands/roleplay/slap.js b/commands/roleplay/slap.js index 7ff1f34a..aed3ad28 100644 --- a/commands/roleplay/slap.js +++ b/commands/roleplay/slap.js @@ -21,7 +21,7 @@ module.exports = class SlapCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToRoleplay = args.thing; + const thingToRoleplay = args.thing; return message.say(`${message.author} *slaps* ${thingToRoleplay}`); } }; diff --git a/commands/search/app-store.js b/commands/search/app-store.js index a1c8a6d6..8d8567ea 100644 --- a/commands/search/app-store.js +++ b/commands/search/app-store.js @@ -27,9 +27,9 @@ module.exports = class AppStoreCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let query = args.query; + const query = args.query; try { - let response = await request + const response = await request .get('https://itunes.apple.com/search') .query({ term: query, @@ -37,8 +37,8 @@ module.exports = class AppStoreCommand extends commando.Command { entity: 'software', limit: 1 }); - let parsedResponse = JSON.parse(response.text); - let data = parsedResponse.results[0]; + const parsedResponse = JSON.parse(response.text); + const data = parsedResponse.results[0]; const embed = new Discord.RichEmbed() .setColor(0x1BA3F7) .setAuthor('App Store', 'https://upload.wikimedia.org/wikipedia/en/1/1f/App_Store_Logo.png') diff --git a/commands/search/botinfo.js b/commands/search/botinfo.js index 6dd15bd9..e7cb6276 100644 --- a/commands/search/botinfo.js +++ b/commands/search/botinfo.js @@ -28,14 +28,14 @@ module.exports = class BotSearchCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let botToFind = args.bot.id; + const botToFind = args.bot.id; try { - let response = await request + const response = await request .get(`https://bots.discord.pw/api/bots/${botToFind}`) .set({ 'Authorization': config.botskey }); - let data = response.body; + const data = response.body; const embed = new Discord.RichEmbed() .setColor(0x9797FF) .setAuthor('Discord Bots', 'https://cdn.discordapp.com/icons/110373943822540800/47336ad0631ac7aac0a48a2ba6246c65.jpg') diff --git a/commands/search/define.js b/commands/search/define.js index 9e93325a..2d5369b9 100644 --- a/commands/search/define.js +++ b/commands/search/define.js @@ -30,9 +30,9 @@ module.exports = class DefineCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let defineThis = encodeURI(args.word); + const defineThis = encodeURI(args.word); try { - let response = await request + const response = await request .get(`http://api.wordnik.com:80/v4/word.json/${defineThis}/definitions`) .query({ limit: 1, @@ -41,7 +41,7 @@ module.exports = class DefineCommand extends commando.Command { includeTags: false, api_key: config.wordnikkey }); - let data = response.body[0]; + const data = response.body[0]; const embed = new Discord.RichEmbed() .setColor(0x9797FF) .setTitle(data.word) diff --git a/commands/search/discrim.js b/commands/search/discrim.js index 3e535706..694a15e6 100644 --- a/commands/search/discrim.js +++ b/commands/search/discrim.js @@ -32,8 +32,8 @@ module.exports = class DiscrimCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let userToSearch = args.discrim; - let users = await this.client.users.filter(u => u.discriminator === userToSearch).map(u => u.username).sort(); + const userToSearch = args.discrim; + const users = await this.client.users.filter(u => u.discriminator === userToSearch).map(u => u.username).sort(); const embed = new Discord.RichEmbed() .setTitle(`${users.length} Users with the discriminator: ${userToSearch}`) .setDescription(users.join(', ')); diff --git a/commands/search/forecast.js b/commands/search/forecast.js index a4ae4bd5..b93d55b5 100644 --- a/commands/search/forecast.js +++ b/commands/search/forecast.js @@ -26,16 +26,16 @@ module.exports = class ForecastCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let locationToSearch = args.locationQ; + const locationToSearch = args.locationQ; try { - let response = await request + const response = await request .get('https://query.yahooapis.com/v1/public/yql') .query({ q: `select * from weather.forecast where u='f' AND woeid in (select woeid from geo.places(1) where text="${locationToSearch}")`, format: 'json' }); - let info = response.body.query.results.channel; - let data = info.item.forecast; + const info = response.body.query.results.channel; + const data = info.item.forecast; const embed = new Discord.RichEmbed() .setColor(0x0000FF) .setAuthor(info.title, 'http://media.idownloadblog.com/wp-content/uploads/2013/12/yahoo-weather-213x220.png') diff --git a/commands/search/google.js b/commands/search/google.js index db95aea9..e7ca4b9a 100644 --- a/commands/search/google.js +++ b/commands/search/google.js @@ -27,10 +27,10 @@ module.exports = class GoogleCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToSearch = args.query; - let searchMsg = await message.say('Searching...'); + const thingToSearch = args.query; + const searchMsg = await message.say('Searching...'); try { - let response = await request + const response = await request .get(`https://www.google.com/search`) .query({ q: thingToSearch diff --git a/commands/search/imdb.js b/commands/search/imdb.js index 443f2aaa..4d841479 100644 --- a/commands/search/imdb.js +++ b/commands/search/imdb.js @@ -28,15 +28,15 @@ module.exports = class IMDBCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let queryMovie = args.movie; + const queryMovie = args.movie; try { - let response = await request + const response = await request .get(`http://www.omdbapi.com/`) .query({ t: queryMovie, plot: 'full' }); - let data = response.body; + const data = response.body; const embed = new Discord.RichEmbed() .setColor(0xDBA628) .setAuthor('IMDB', 'http://static.wixstatic.com/media/c65cbf_31901b544fe24f1890134553bf40c8be.png') diff --git a/commands/search/neopet.js b/commands/search/neopet.js index fc058603..b36947f1 100644 --- a/commands/search/neopet.js +++ b/commands/search/neopet.js @@ -21,7 +21,7 @@ module.exports = class NeopetCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'ATTACH_FILES'])) return; } console.log(`[Command] ${message.content}`); - let petID = args.pet; + const petID = args.pet; return message.say(`http://pets.neopets.com/cp/${petID}/1/5.png`); } }; diff --git a/commands/search/osu.js b/commands/search/osu.js index 101f2c7f..5530c294 100644 --- a/commands/search/osu.js +++ b/commands/search/osu.js @@ -29,16 +29,16 @@ module.exports = class OsuCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let usernameToSearch = args.username; + const usernameToSearch = args.username; try { - let response = await request + const response = await request .get('https://osu.ppy.sh/api/get_user') .query({ k: config.osukey, u: usernameToSearch, type: 'string' }); - let data = response.body[0]; + const data = response.body[0]; const embed = new Discord.RichEmbed() .setColor(0xFF66AA) .setAuthor('osu!', 'http://vignette3.wikia.nocookie.net/osugame/images/c/c9/Logo.png/revision/latest?cb=20151219073209') diff --git a/commands/search/pokedex.js b/commands/search/pokedex.js index be51b641..3eaa8a56 100644 --- a/commands/search/pokedex.js +++ b/commands/search/pokedex.js @@ -32,7 +32,7 @@ module.exports = class PokedexCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let pokemon = args.pokemon.toLowerCase(); + const pokemon = args.pokemon.toLowerCase(); const embed = new Discord.RichEmbed() .setTitle('Information') .setAuthor(`#${pokedex.index[pokemon]} ${pokedex.name[pokemon]}`, `http://www.serebii.net/pokedex-sm/icon/${pokedex.index[pokemon]}.png`) diff --git a/commands/search/urban.js b/commands/search/urban.js index 188ae5f5..a6631bac 100644 --- a/commands/search/urban.js +++ b/commands/search/urban.js @@ -28,14 +28,14 @@ module.exports = class UrbanDictionary extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let wordToDefine = args.word; + const wordToDefine = args.word; try { - let response = await request + const response = await request .get('http://api.urbandictionary.com/v0/define') .query({ term: wordToDefine }); - let data = response.body.list[0]; + const data = response.body.list[0]; const embed = new Discord.RichEmbed() .setColor(0x32a8f0) .setAuthor('Urban Dictionary', 'http://a1.mzstatic.com/eu/r30/Purple71/v4/66/54/68/6654683f-cacd-4a55-1784-f14257f77874/icon175x175.png') diff --git a/commands/search/wattpad.js b/commands/search/wattpad.js index 1fb18f6e..4a771af5 100644 --- a/commands/search/wattpad.js +++ b/commands/search/wattpad.js @@ -24,9 +24,9 @@ module.exports = class WattpadCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let queryBook = args.book; + const queryBook = args.book; try { - let response = await request + const response = await request .get('https://api.wattpad.com:443/v4/stories') .set({ 'Authorization': `Basic ${config.wattpadkey}` @@ -35,7 +35,7 @@ module.exports = class WattpadCommand extends commando.Command { query: queryBook, limit: 1 }); - let data = response.body.stories[0]; + const data = response.body.stories[0]; const embed = new Discord.RichEmbed() .setColor(0xF89C34) .setAuthor('Wattpad', 'http://www.selfpubtoolbox.com/wp-content/uploads/2015/05/a6044fd3a88acd5043860484db972ca6.png') diff --git a/commands/search/weather.js b/commands/search/weather.js index ab803258..0d839eff 100644 --- a/commands/search/weather.js +++ b/commands/search/weather.js @@ -23,15 +23,15 @@ module.exports = class WeatherCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let locationToSearch = args.locationQ; + const locationToSearch = args.locationQ; try { - let response = await request + const response = await request .get('https://query.yahooapis.com/v1/public/yql') .query({ q: `select * from weather.forecast where u='f' AND woeid in (select woeid from geo.places(1) where text="${locationToSearch}")`, format: 'json' }); - let data = response.body.query.results.channel; + const data = response.body.query.results.channel; const embed = new Discord.RichEmbed() .setColor(0x0000FF) .setAuthor(data.title, 'http://media.idownloadblog.com/wp-content/uploads/2013/12/yahoo-weather-213x220.png') diff --git a/commands/search/wikipedia.js b/commands/search/wikipedia.js index 432bef93..f5ca7d5f 100644 --- a/commands/search/wikipedia.js +++ b/commands/search/wikipedia.js @@ -23,11 +23,10 @@ module.exports = class WikipediaCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let thingToSearch = args.query; - thingToSearch = thingToSearch.split(")").join("%29"); - let title = encodeURI(thingToSearch); + const thingToSearch = args.query.split(")").join("%29"); + const title = encodeURI(thingToSearch); try { - let response = await request + const response = await request .get(`https://en.wikipedia.org/w/api.php`) .query({ action: 'query', @@ -39,8 +38,8 @@ module.exports = class WikipediaCommand extends commando.Command { redirects: '', formatversion: 2 }); - let data = response.body.query.pages[0]; - let description = data.extract.substr(0, 1900).split('\n').join('\n\n'); + const data = response.body.query.pages[0]; + const description = data.extract.substr(0, 1900).split('\n').join('\n\n'); const embed = new Discord.RichEmbed() .setColor(0xE7E7E7) .setTitle(data.title) diff --git a/commands/search/youtube.js b/commands/search/youtube.js index d3b5a7f9..d1a2430e 100644 --- a/commands/search/youtube.js +++ b/commands/search/youtube.js @@ -27,9 +27,9 @@ module.exports = class YouTubeCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let videoToSearch = args.video; + const videoToSearch = args.video; try { - let response = await request + const response = await request .get('https://www.googleapis.com/youtube/v3/search') .query({ part: 'snippet', @@ -38,7 +38,7 @@ module.exports = class YouTubeCommand extends commando.Command { q: videoToSearch, key: config.youtubekey }); - let data = response.body.items[0]; + const data = response.body.items[0]; const embed = new Discord.RichEmbed() .setColor(0xDD2825) .setTitle(data.snippet.title) diff --git a/commands/search/yugioh.js b/commands/search/yugioh.js index 850ed70b..6fa8ddb8 100644 --- a/commands/search/yugioh.js +++ b/commands/search/yugioh.js @@ -23,11 +23,11 @@ module.exports = class YuGiOhCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let cardName = encodeURI(args.card); + const cardName = encodeURI(args.card); try { - let response = await request + const response = await request .get(`http://yugiohprices.com/api/card_data/${cardName}`); - let data = response.body.data; + const data = response.body.data; if (data.card_type === 'monster') { const embed = new Discord.RichEmbed() .setColor(0xBE5F1F) diff --git a/commands/textedit/binary.js b/commands/textedit/binary.js index 5284be26..bc61a65f 100644 --- a/commands/textedit/binary.js +++ b/commands/textedit/binary.js @@ -28,8 +28,8 @@ module.exports = class BinaryCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let turnToBinary = args.text; - let binaryText = stringToBinary(turnToBinary); + const turnToBinary = args.text; + const binaryText = stringToBinary(turnToBinary); return message.say(binaryText); } }; diff --git a/commands/textedit/cowsay.js b/commands/textedit/cowsay.js index 37d0bfc3..9242f5a7 100644 --- a/commands/textedit/cowsay.js +++ b/commands/textedit/cowsay.js @@ -22,7 +22,7 @@ module.exports = class CowsayCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let turnToCowsay = args.text; + const turnToCowsay = args.text; return message.code(null, cowsay.say({ text: turnToCowsay, e: "oO", diff --git a/commands/textedit/embed.js b/commands/textedit/embed.js index 1c30e5ad..68235a33 100644 --- a/commands/textedit/embed.js +++ b/commands/textedit/embed.js @@ -23,14 +23,13 @@ module.exports = class EmbedCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let embedMessage = message.content.split(" ").slice(1).join(" "); + const embedMessage = message.content.split(" ").slice(1).join(" "); const embed = new Discord.RichEmbed() .setAuthor(message.author.username, message.author.avatarURL) .setColor(0x00AE86) .setTimestamp() .setDescription(embedMessage); - let deleteMsg = await message.delete(); - let embedSend = await message.embed(embed); - return [deleteMsg, embedSend]; + await message.delete(); + return message.embed(embed); } }; diff --git a/commands/textedit/morse.js b/commands/textedit/morse.js index cade6bf0..270d4f7b 100644 --- a/commands/textedit/morse.js +++ b/commands/textedit/morse.js @@ -20,7 +20,7 @@ module.exports = class MorseCommand extends commando.Command { if (method.toLowerCase() === 'encode' || method.toLowerCase() === 'decode') { return true; } - return 'Please enter either `encode` or `decode`.' + return 'Please enter either `encode` or `decode`.'; } }, { key: 'text', @@ -35,8 +35,8 @@ module.exports = class MorseCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let methodToUse = args.method.toLowerCase(); - let toMorse = args.text; + const methodToUse = args.method.toLowerCase(); + const toMorse = args.text; if (methodToUse === 'encode') { return message.say(morse.encode(toMorse)).catch(error => message.say(':x: Error! Something went wrong! Perhaps you entered incorrect text?')); } diff --git a/commands/textedit/pirate.js b/commands/textedit/pirate.js index f8708d91..b39e3f6d 100644 --- a/commands/textedit/pirate.js +++ b/commands/textedit/pirate.js @@ -32,8 +32,8 @@ module.exports = class PirateCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let turnToPirate = args.text; - let pirate = pirateSpeak.translate(turnToPirate); + const turnToPirate = args.text; + const pirate = pirateSpeak.translate(turnToPirate); if (pirate.length > 1950) return message.say(":x: Error! Your message is too long!"); return message.say(pirate); } diff --git a/commands/textedit/reverse.js b/commands/textedit/reverse.js index 193383aa..1b65e7ac 100644 --- a/commands/textedit/reverse.js +++ b/commands/textedit/reverse.js @@ -21,8 +21,8 @@ module.exports = class ReverseCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let stringToReverse = args.text; - let reversed = stringToReverse.split("").reverse().join(""); + const stringToReverse = args.text; + const reversed = stringToReverse.split("").reverse().join(""); return message.say(reversed); } }; diff --git a/commands/textedit/romaji.js b/commands/textedit/romaji.js index 893c35ae..4c73e3a0 100644 --- a/commands/textedit/romaji.js +++ b/commands/textedit/romaji.js @@ -34,8 +34,8 @@ module.exports = class RomajiCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let romajify = args.kana; - let romajified = hepburn.fromKana(romajify); + const romajify = args.kana; + const romajified = hepburn.fromKana(romajify); return message.say(romajified); } }; diff --git a/commands/textedit/say.js b/commands/textedit/say.js index b3fb6c05..1fba53de 100644 --- a/commands/textedit/say.js +++ b/commands/textedit/say.js @@ -28,9 +28,8 @@ module.exports = class SayCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'MANAGE_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let copycat = args.text; - let deleteMsg = await message.delete(); - let copyMsg = await message.say(copycat); - return [deleteMsg, copyMsg]; + const copycat = args.text; + await message.delete(); + return message.say(copycat); } }; diff --git a/commands/textedit/shuffle.js b/commands/textedit/shuffle.js index 39f4209d..346bc995 100644 --- a/commands/textedit/shuffle.js +++ b/commands/textedit/shuffle.js @@ -33,7 +33,7 @@ module.exports = class ShuffleCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToShuffle = args.text; + const thingToShuffle = args.text; return message.say(thingToShuffle.shuffle()); } }; diff --git a/commands/textedit/temmie.js b/commands/textedit/temmie.js index 30c41eca..9538064e 100644 --- a/commands/textedit/temmie.js +++ b/commands/textedit/temmie.js @@ -1,290 +1,5 @@ const commando = require('discord.js-commando'); - -const dictionary = { - "i": "tem", - "hi": "hoi", - "that": "dat", - "that's": "dat", - "hello": "hoi", - "me": "temmie", - "goodbye": "boi", - "bye": "boi", - "later": "boi", - "college": "colleg", - "money": "muns", - "food": "tem flakes", - "snack": "tem flakes", - "snacks": "tem flakes", - "meal": "tem flakes", - "meals": "tem flakes", - "human": "hooman", - "humans": "hoomans", - "chocolate": "choco", - "cute": "coot", - "allergic": "allergics", - "allergy": "allergics", - "do": "dos", - "does": "dos", - "what": "ppppppppp...", - "who": "ppppppppp...", - "when": "ppppppppp...", - "why": "ppppppppp...", - "where": "ppppppppp...", - "how": "ppppppppp...", - "xd": "xd", - "but": "b-but", - "store": "tem shop", - "restaurant": "tem shop", - "shop": "tem shop", - "temmie": "temmiy", - "sick": "holves", - "illness": "holves", - "ill": "holves", - "disease": "holves", - "cat": "tem", - "dog": 'tem', - "hugs": "pets", - "pats": "pets", - "waves": "pets", - "high-fives": "pets", - "fistbumps": "pets", - "hug": "pet", - "pat": "pet", - "wave": "pet", - "high-five": "pet", - "fistbump": "pet", - "hungry": "hungr", - "muscles": "not coot", - "aw": "awwawa", - "yikes": "omg!", - "ah": "omg!", - "oh": "omg!", - "yipe": "omg!", - "wait": "omg!", - "yes": "yee!", - "no": "no!", - "person": "bark", - "monster": "munster", - "monsters": "munsters", - "great": "tem outta tem", - "awesome": "tem outta tem", - "cool": "tem outta tem", - "nice": "tem outta tem", - "good": "tem outta tem", - "walks": "vibrates", - "moves": "vibrates", - "sits": "vibrates", - "goes": "vibrates", - "runs": "vibrates intensely", - "climbs": "vibrates intensely", - "escapes": "vibrates intensely", - "normal": "bob", - "hmm": "p...", - "okay": "ok", - "lol": "lel", - "enemy": "special enemy", - "villain": "special enemy", - "bad guy": "special enemy", - "badguy": "special enemy", - "school": "skool", - "um": "p...", - "elizabeth": "ebears", - "yeah": "yaya", - "yea": "yaya", - "uh-huh": "yaya", - "vampire": "wampire", - "tired": "*dies*", - "exhausted": "*dies*", - "bored": "*dies*", - "annoyed": "*dies*", - "irritated": "*dies*", - "mad": "*dies*", - "sleepy": "*dies*", - "confused": "*dies*", - "house": "tem villag", - "home": "tem villag", - "apartment": "tem villag", - "world": "undergroun", - "hotel": "mtt resort", - "motel": "mtt resort", - "inn": "mtt resort", - "cash": "g", - "gold": "g", - "jewels": "g", - "aaron": "not coot", - "boy": "tim", - "girl": "tem", - "we": "tems", - "you": "u", - "your": "ur", - "yours": "urs", - "there": "dere", - "proud": "prouds", - "random": "rando", - "see": "c", - "this": "dis", - "egg": "eg", - "very": "very!", - "excited": "excite", - "doesn't": "don't", - "sleep": "slep", - "noodles": "alphys foob", - "scream": "screems", - "gonna": "gunna", - "pasta": "papy foob", - "spaghetti": "papy foob", - "scary": "scaredy", - "frightening": "scaredy", - "worry": "worrys", - "worries": "worrys", - "sushi": "undyne foob", - "banana": "bernerner", - "bananas": "bernerners", - "apple": "oppl", - "apples": "oppls", - "grape": "grep", - "grapes": "greps", - "wonder": "wunders", - "wonders": "wunders", - "wondering": "wunders", - "wonderful": "wunderfull", - "think": "finks", - "thinks": "finks", - "thought": "finked", - "beat": "dunks", - "defeat": "dunks", - "defeated": "dunkd", - "they're": "their", - "their": "there", - "you're": "ur", - "because": "cuz", - "bc": "cuz", - "will": "wil", - "things": "thins", - "thing": "thin", - "science": "scienc", - "ice cream": "noice creem", - "spear": "speer", - "baby": "temini", - "babies": "teminis", - "child": "temini", - "children": "teminis", - "kid": "temini", - "kids": "teminis", - "bot": "xiao", - "robot": "mettatun", - "ghost": "bluuk", - "nap": "slep", - "boop": "blep", - "beep": "blep", - "bleep": "blep", - "bop": "blep", - "spider": "spoider", - "spiders": "sploiders", - "music": "moosics", - "again": "agin", - "the": "teh", - "family": "fam", - "smart": "smarts", - "smartness": "smartiness", - "intelligence": "smartiness", - "typo": "tpyo", - "typo'd": "tyop'd", - "typos": "typoys", - "yay": "yee", - "potato": "tato", - "potatoes": "tatos", - "fry": "fri", - "fries": "fri", - "burger": "glamburg", - "steak": "stek", - "heart": "hart", - "love": "lub", - "hate": "h8", - "like": "liek", - "library": "librarby", - "fire": "flemz", - "flame": "flemz", - "fires": "flemz", - "flames": "flemz", - "witchcraft": "magics", - "witchcrafts": "magics", - "magic": "magics", - "sorcery": "magics", - "superpower": "magics", - "superpowers": "magics", - "sorceries": "magics", - "and": "n", - "my": "tem's", - "mine": "tem's", - "everyone": "everytem", - "anyone": "anytem", - "someone": "sometem", - "everbody": "everytemmie", - "anybody": "anytemmie", - "somebody": "sometemmie", - "beautiful": "booftifull", - "pretty": "prety", - "so": "soooo", - "help": "halp", - "uh-uh": "nuh", - "nope": "nuh", - "nuh-uh": "nuh", - "please": "pls" -}; - -function translateWord(word) { - let wordTranslate = dictionary[word.toLowerCase()]; - if (wordTranslate === undefined) return word; - else return applyCase(word, wordTranslate); -} - -function applyCase(wordA, wordB) { - if (wordA.length === 1 && wordB.length !== 1) return wordB; - if (wordA === wordA.toUpperCase()) return wordB.toUpperCase(); - if (wordA === wordA.toLowerCase()) return wordB.toLowerCase(); - let firstChar = wordA.slice(0, 1); - let otherChars = wordA.slice(1); - if (firstChar === firstChar.toUpperCase() && otherChars === otherChars.toLowerCase()) { - return wordB.slice(0, 1).toUpperCase() + wordB.slice(1).toLowerCase(); - } - return wordB; -} - -function isLetter(character) { - if (character.search(/[a-zA-Z'-]/) === -1) return false; - return true; -} - -function translator(text) { - let translatedText = ""; - let word = ""; - for (let i = 0; i < text.length; i += 1) { - let character = text[i]; - if (isLetter(character)) { - word += character; - } - else { - if (word != "") { - let wordTranslate = translateWord(word); - translatedText += wordTranslate; - word = ""; - } - translatedText += character; - } - } - - if (word !== "") translatedText += translateWord(word); - - return translatedText; -} - -const temmize = function(text) { - let currentTranslation = translator(text); - let temmify = currentTranslation.split("ing").join("in").split("!").join("!!!!111!11!1!!!1!!!1111!").split("'").join(""); - - return temmify; -}; +const temmize = require('./temmize.js'); module.exports = class TemmieCommand extends commando.Command { constructor(Client) { @@ -313,8 +28,8 @@ module.exports = class TemmieCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let thingToTranslate = args.text; - let temmized = temmize(thingToTranslate); + const thingToTranslate = args.text; + const temmized = temmize(thingToTranslate); return message.say(temmized); } }; diff --git a/commands/textedit/temmize.js b/commands/textedit/temmize.js new file mode 100644 index 00000000..b6760bf4 --- /dev/null +++ b/commands/textedit/temmize.js @@ -0,0 +1,285 @@ +const dictionary = { + "i": "tem", + "hi": "hoi", + "that": "dat", + "that's": "dat", + "hello": "hoi", + "me": "temmie", + "goodbye": "boi", + "bye": "boi", + "later": "boi", + "college": "colleg", + "money": "muns", + "food": "tem flakes", + "snack": "tem flakes", + "snacks": "tem flakes", + "meal": "tem flakes", + "meals": "tem flakes", + "human": "hooman", + "humans": "hoomans", + "chocolate": "choco", + "cute": "coot", + "allergic": "allergics", + "allergy": "allergics", + "do": "dos", + "does": "dos", + "what": "ppppppppp...", + "who": "ppppppppp...", + "when": "ppppppppp...", + "why": "ppppppppp...", + "where": "ppppppppp...", + "how": "ppppppppp...", + "xd": "xd", + "but": "b-but", + "store": "tem shop", + "restaurant": "tem shop", + "shop": "tem shop", + "temmie": "temmiy", + "sick": "holves", + "illness": "holves", + "ill": "holves", + "disease": "holves", + "cat": "tem", + "dog": 'tem', + "hugs": "pets", + "pats": "pets", + "waves": "pets", + "high-fives": "pets", + "fistbumps": "pets", + "hug": "pet", + "pat": "pet", + "wave": "pet", + "high-five": "pet", + "fistbump": "pet", + "hungry": "hungr", + "muscles": "not coot", + "aw": "awwawa", + "yikes": "omg!", + "ah": "omg!", + "oh": "omg!", + "yipe": "omg!", + "wait": "omg!", + "yes": "yee!", + "no": "no!", + "person": "bark", + "monster": "munster", + "monsters": "munsters", + "great": "tem outta tem", + "awesome": "tem outta tem", + "cool": "tem outta tem", + "nice": "tem outta tem", + "good": "tem outta tem", + "walks": "vibrates", + "moves": "vibrates", + "sits": "vibrates", + "goes": "vibrates", + "runs": "vibrates intensely", + "climbs": "vibrates intensely", + "escapes": "vibrates intensely", + "normal": "bob", + "hmm": "p...", + "okay": "ok", + "lol": "lel", + "enemy": "special enemy", + "villain": "special enemy", + "bad guy": "special enemy", + "badguy": "special enemy", + "school": "skool", + "um": "p...", + "elizabeth": "ebears", + "yeah": "yaya", + "yea": "yaya", + "uh-huh": "yaya", + "vampire": "wampire", + "tired": "*dies*", + "exhausted": "*dies*", + "bored": "*dies*", + "annoyed": "*dies*", + "irritated": "*dies*", + "mad": "*dies*", + "sleepy": "*dies*", + "confused": "*dies*", + "house": "tem villag", + "home": "tem villag", + "apartment": "tem villag", + "world": "undergroun", + "hotel": "mtt resort", + "motel": "mtt resort", + "inn": "mtt resort", + "cash": "g", + "gold": "g", + "jewels": "g", + "aaron": "not coot", + "boy": "tim", + "girl": "tem", + "we": "tems", + "you": "u", + "your": "ur", + "yours": "urs", + "there": "dere", + "proud": "prouds", + "random": "rando", + "see": "c", + "this": "dis", + "egg": "eg", + "very": "very!", + "excited": "excite", + "doesn't": "don't", + "sleep": "slep", + "noodles": "alphys foob", + "scream": "screems", + "gonna": "gunna", + "pasta": "papy foob", + "spaghetti": "papy foob", + "scary": "scaredy", + "frightening": "scaredy", + "worry": "worrys", + "worries": "worrys", + "sushi": "undyne foob", + "banana": "bernerner", + "bananas": "bernerners", + "apple": "oppl", + "apples": "oppls", + "grape": "grep", + "grapes": "greps", + "wonder": "wunders", + "wonders": "wunders", + "wondering": "wunders", + "wonderful": "wunderfull", + "think": "finks", + "thinks": "finks", + "thought": "finked", + "beat": "dunks", + "defeat": "dunks", + "defeated": "dunkd", + "they're": "their", + "their": "there", + "you're": "ur", + "because": "cuz", + "bc": "cuz", + "will": "wil", + "things": "thins", + "thing": "thin", + "science": "scienc", + "ice cream": "noice creem", + "spear": "speer", + "baby": "temini", + "babies": "teminis", + "child": "temini", + "children": "teminis", + "kid": "temini", + "kids": "teminis", + "bot": "xiao", + "robot": "mettatun", + "ghost": "bluuk", + "nap": "slep", + "boop": "blep", + "beep": "blep", + "bleep": "blep", + "bop": "blep", + "spider": "spoider", + "spiders": "sploiders", + "music": "moosics", + "again": "agin", + "the": "teh", + "family": "fam", + "smart": "smarts", + "smartness": "smartiness", + "intelligence": "smartiness", + "typo": "tpyo", + "typo'd": "tyop'd", + "typos": "typoys", + "yay": "yee", + "potato": "tato", + "potatoes": "tatos", + "fry": "fri", + "fries": "fri", + "burger": "glamburg", + "steak": "stek", + "heart": "hart", + "love": "lub", + "hate": "h8", + "like": "liek", + "library": "librarby", + "fire": "flemz", + "flame": "flemz", + "fires": "flemz", + "flames": "flemz", + "witchcraft": "magics", + "witchcrafts": "magics", + "magic": "magics", + "sorcery": "magics", + "superpower": "magics", + "superpowers": "magics", + "sorceries": "magics", + "and": "n", + "my": "tem's", + "mine": "tem's", + "everyone": "everytem", + "anyone": "anytem", + "someone": "sometem", + "everbody": "everytemmie", + "anybody": "anytemmie", + "somebody": "sometemmie", + "beautiful": "booftifull", + "pretty": "prety", + "so": "soooo", + "help": "halp", + "uh-uh": "nuh", + "nope": "nuh", + "nuh-uh": "nuh", + "please": "pls" +}; + +function translateWord(word) { + let wordTranslate = dictionary[word.toLowerCase()]; + if (wordTranslate === undefined) return word; + else return applyCase(word, wordTranslate); +} + +function applyCase(wordA, wordB) { + if (wordA.length === 1 && wordB.length !== 1) return wordB; + if (wordA === wordA.toUpperCase()) return wordB.toUpperCase(); + if (wordA === wordA.toLowerCase()) return wordB.toLowerCase(); + let firstChar = wordA.slice(0, 1); + let otherChars = wordA.slice(1); + if (firstChar === firstChar.toUpperCase() && otherChars === otherChars.toLowerCase()) { + return wordB.slice(0, 1).toUpperCase() + wordB.slice(1).toLowerCase(); + } + return wordB; +} + +function isLetter(character) { + if (character.search(/[a-zA-Z'-]/) === -1) return false; + return true; +} + +function translator(text) { + let translatedText = ""; + let word = ""; + for (let i = 0; i < text.length; i += 1) { + let character = text[i]; + if (isLetter(character)) { + word += character; + } + else { + if (word != "") { + let wordTranslate = translateWord(word); + translatedText += wordTranslate; + word = ""; + } + translatedText += character; + } + } + + if (word !== "") translatedText += translateWord(word); + + return translatedText; +} + +module.exports = function(text) { + let currentTranslation = translator(text); + let temmify = currentTranslation.split("ing").join("in").split("!").join("!!!!111!11!1!!!1!!!1111!").split("'").join(""); + + return temmify; +}; diff --git a/commands/textedit/translate.js b/commands/textedit/translate.js index 6c9fb36e..ce919f34 100644 --- a/commands/textedit/translate.js +++ b/commands/textedit/translate.js @@ -146,13 +146,13 @@ module.exports = class TranslateCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let languageto = args.to.toLowerCase(); - let thingToTranslate = args.text; + const languageto = args.to.toLowerCase(); + const thingToTranslate = args.text; try { - let res = await translate(thingToTranslate, { + const res = await translate(thingToTranslate, { to: languageto }); - let languagefrom = res.from.language.iso.toLowerCase(); + const languagefrom = res.from.language.iso.toLowerCase(); const embed = new Discord.RichEmbed() .setColor(0x00AE86) .addField(`Input (From: ${languages[languagefrom]}):`, diff --git a/commands/textedit/webhook.js b/commands/textedit/webhook.js index d3225fa3..b311f43f 100644 --- a/commands/textedit/webhook.js +++ b/commands/textedit/webhook.js @@ -31,15 +31,15 @@ module.exports = class WebhookCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'MANAGE_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let content = args.text; + const content = args.text; try { - let post = await request + await message.delete(); + const post = await request .post(config.webhook) .send({ content: content }); - let deleteMsg = await message.delete(); - return [post, deleteMsg]; + return post; } catch (err) { return message.say(':x: Error! Message failed to send!'); diff --git a/commands/textedit/yoda.js b/commands/textedit/yoda.js index 80424d0b..bdf29089 100644 --- a/commands/textedit/yoda.js +++ b/commands/textedit/yoda.js @@ -23,9 +23,9 @@ module.exports = class YodaCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let turnToYoda = args.text; + const turnToYoda = args.text; try { - let response = await request + const response = await request .get('https://yoda.p.mashape.com/yoda') .set({ 'X-Mashape-Key': config.mashapekey, diff --git a/commands/textedit/zalgo.js b/commands/textedit/zalgo.js index fb46b2e3..3f02d22e 100644 --- a/commands/textedit/zalgo.js +++ b/commands/textedit/zalgo.js @@ -28,7 +28,7 @@ module.exports = class ZalgoCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let zalgoified = zalgo(args.text); + const zalgoified = zalgo(args.text); return message.say(zalgoified); } }; diff --git a/commands/userinfo/avatar.js b/commands/userinfo/avatar.js index 4a3a144f..7dde98e8 100644 --- a/commands/userinfo/avatar.js +++ b/commands/userinfo/avatar.js @@ -21,7 +21,7 @@ module.exports = class AvatarCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let user = args.user; + const user = args.user; return message.say(user.displayAvatarURL); } }; diff --git a/commands/userinfo/userinfo.js b/commands/userinfo/userinfo.js index 72c2ba7d..5d00d576 100644 --- a/commands/userinfo/userinfo.js +++ b/commands/userinfo/userinfo.js @@ -30,7 +30,7 @@ module.exports = class UserInfoCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let user = args.user; + const user = args.user; let stat; let color; switch (user.presence.status) { @@ -51,13 +51,7 @@ module.exports = class UserInfoCommand extends commando.Command { color = 0x808080; break; } - let userGame; - if (!user.presence.game) { - userGame = "None"; - } - else { - userGame = user.presence.game.name; - } + const userGame = user.presence.game; const embed = new Discord.RichEmbed() .setColor(color) .setThumbnail(user.displayAvatarURL) @@ -72,7 +66,7 @@ module.exports = class UserInfoCommand extends commando.Command { .addField('**Status:**', stat, true) .addField('**Playing:**', - userGame, true); + userGame.name || 'None', true); return message.embed(embed); } }; diff --git a/commands/util/servers.js b/commands/util/servers.js index 22514177..34b5e932 100644 --- a/commands/util/servers.js +++ b/commands/util/servers.js @@ -22,8 +22,8 @@ module.exports = class ServersCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log(`[Command] ${message.content}`); - let guildCount = this.client.guilds.size; - let guildNames = this.client.guilds.map(g => `${g.name} (${g.id})`).join(", "); + const guildCount = this.client.guilds.size; + const guildNames = this.client.guilds.map(g => `${g.name} (${g.id})`).join(", "); console.log(`${guildCount} Servers: ${guildNames}`); return message.say("Sent the information to the console!"); } diff --git a/index.js b/index.js index d346afcd..9147f435 100644 --- a/index.js +++ b/index.js @@ -35,7 +35,7 @@ client.registry client.on('guildCreate', async(guild) => { console.log(`[Guild] I have joined the guild: ${guild.name}, Owned by: ${guild.owner.user.username} (${guild.id})!`); client.guilds.get(config.server).channels.get(config.announcementChannel).send(`I have joined the server: ${guild.name}, Owned by: ${guild.owner.user.username} (${guild.id})!`); - let results = await client.shard.fetchClientValues('guilds.size'); + const results = await client.shard.fetchClientValues('guilds.size'); console.log(`[Guild Count] ${results.reduce((prev, val) => prev + val, 0)}`); try { let response = await request @@ -68,7 +68,7 @@ client.on('guildCreate', async(guild) => { client.on('guildDelete', async(guild) => { console.log(`[Guild] I have left the guild: ${guild.name}, Owned by: ${guild.owner.user.username} (${guild.id})...`); client.guilds.get(config.server).channels.get(config.announcementChannel).send(`I have left the server: ${guild.name}, Owned by: ${guild.owner.user.username} (${guild.id})...`); - let results = await client.shard.fetchClientValues('guilds.size'); + const results = await client.shard.fetchClientValues('guilds.size'); console.log(`[Guild Count] ${results.reduce((prev, val) => prev + val, 0)}`); try { let response = await request