From 8ba552b21a78d8d9718b61b64877d61edc2c5d17 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Mon, 8 May 2017 13:46:36 +0000 Subject: [PATCH] Space after conditionals --- commands/avataredit/3000years.js | 14 ++++++-------- commands/avataredit/beautiful.js | 14 ++++++-------- commands/avataredit/bobross.js | 14 ++++++-------- commands/avataredit/greyscale.js | 14 ++++++-------- commands/avataredit/invert.js | 10 +++++----- commands/avataredit/rip.js | 15 ++++++--------- commands/avataredit/steamcard.js | 14 ++++++-------- commands/avataredit/triggered.js | 10 +++++----- commands/avataredit/wanted.js | 10 +++++----- commands/games/lottery.js | 2 +- commands/games/mathgame.js | 10 +++++----- commands/games/quiz.js | 14 ++++++-------- commands/games/rockpaperscissors.js | 30 ++++++++++++++--------------- commands/games/slots.js | 2 +- commands/games/typinggame.js | 10 +++++----- commands/guildinfo/guildinfo.js | 8 ++------ commands/moderation/ban.js | 20 +++++++++---------- commands/moderation/kick.js | 16 +++++++-------- commands/moderation/lockdown.js | 12 ++++++------ commands/moderation/prune.js | 8 ++++---- commands/moderation/softban.js | 19 +++++++++--------- commands/moderation/unban.js | 20 +++++++++---------- commands/moderation/warn.js | 10 +++++----- commands/numedit/currency.js | 8 ++++---- commands/numedit/math.js | 2 +- commands/numedit/temperature.js | 24 +++++++++++------------ commands/random/easteregg.js | 6 ++---- commands/random/meme.js | 8 ++++---- commands/random/nitro.js | 4 ++-- commands/random/spam.js | 6 +++--- commands/random/strawpoll.js | 10 +++++----- commands/random/today.js | 6 +++--- commands/random/wouldyourather.js | 10 ++++------ commands/randomimg/cat.js | 12 +++++------- commands/randomimg/dog.js | 8 ++++---- commands/randomimg/xiaopai.js | 10 ++++------ commands/response/coin.js | 5 +---- commands/response/name.js | 6 +++--- commands/response/quantumcoin.js | 4 +--- commands/response/ratewaifu.js | 4 +--- commands/response/roll.js | 4 +--- commands/response/ship.js | 4 +--- commands/search/botinfo.js | 6 +++--- commands/search/define.js | 8 ++++---- commands/search/discrim.js | 11 ++++------- commands/search/forecast.js | 8 ++++---- commands/search/google.js | 4 ++-- commands/search/imdb.js | 8 ++++---- commands/search/map.js | 10 +++++----- commands/search/neopet.js | 4 ++-- commands/search/osu.js | 8 ++++---- commands/search/soundcloud.js | 8 ++++---- commands/search/urban.js | 8 ++++---- commands/search/wattpad.js | 8 ++++---- commands/search/weather.js | 8 ++++---- commands/search/wikipedia.js | 8 ++++---- commands/search/youtube.js | 8 ++++---- commands/search/yugioh.js | 10 +++++----- commands/textedit/binary.js | 2 +- commands/textedit/cowsay.js | 2 +- commands/textedit/embed.js | 4 ++-- commands/textedit/morse.js | 2 +- commands/textedit/pirate.js | 2 +- commands/textedit/say.js | 7 ++----- commands/textedit/temmie.js | 2 +- commands/textedit/upsidedown.js | 4 +--- commands/textedit/webhook.js | 9 +++------ commands/textedit/zalgo.js | 2 +- commands/userinfo/userinfo.js | 10 +++------- commands/util/clearsetting.js | 2 +- commands/util/help.js | 14 ++++++-------- commands/util/info.js | 8 +++----- commands/util/membermsg.js | 12 +++++------- commands/util/shardinfo.js | 10 ++++------ index.js | 30 ++++++++++++++--------------- package.json | 2 +- providers/Sequelize.js | 2 +- structures/PostgreSQL.js | 4 ++-- 78 files changed, 313 insertions(+), 379 deletions(-) diff --git a/commands/avataredit/3000years.js b/commands/avataredit/3000years.js index cd90af9c..e6fb60a3 100644 --- a/commands/avataredit/3000years.js +++ b/commands/avataredit/3000years.js @@ -5,9 +5,7 @@ module.exports = class YearsCommand extends Command { constructor(client) { super(client, { name: '3000years', - aliases: [ - 'az' - ], + aliases: ['az'], group: 'avataredit', memberName: '3000years', description: 'It\'s been 3000 years...', @@ -22,12 +20,12 @@ module.exports = class YearsCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) return msg.say('This Command requires the `Attach Files` Permission.'); const { user } = args; const avatarURL = user.avatarURL('png', 2048); - if(!avatarURL) return msg.say('This user has no avatar.'); + if (!avatarURL) return msg.say('This user has no avatar.'); let images = []; images.push(Jimp.read(avatarURL)); images.push(Jimp.read('https://i.imgur.com/eScwGFS.png')); @@ -35,9 +33,9 @@ module.exports = class YearsCommand extends Command { avatar.resize(200, 200); az.composite(avatar, 461, 127); az.getBuffer(Jimp.MIME_PNG, (err, buff) => { - if(err) return msg.say(`An Error Occurred: ${err}`); + if (err) return msg.say(`An Error Occurred: ${err}`); return msg.channel.send({ files: [{ attachment: buff, name: 'az.png' }] }) - .catch(err => msg.say(`An Error Occurred: ${err}`)); + .catch (err => msg.say(`An Error Occurred: ${err}`)); }); } }; diff --git a/commands/avataredit/beautiful.js b/commands/avataredit/beautiful.js index 0af375d8..f72a7273 100644 --- a/commands/avataredit/beautiful.js +++ b/commands/avataredit/beautiful.js @@ -5,9 +5,7 @@ module.exports = class BeautifulCommand extends Command { constructor(client) { super(client, { name: 'beautiful', - aliases: [ - 'grunkle-stan' - ], + aliases: ['grunkle-stan'], group: 'avataredit', memberName: 'beautiful', description: 'Oh, this? This is beautiful.', @@ -22,12 +20,12 @@ module.exports = class BeautifulCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) return msg.say('This Command requires the `Attach Files` Permission.'); const { user } = args; const avatarURL = user.avatarURL('png', 2048); - if(!avatarURL) return msg.say('This user has no avatar.'); + if (!avatarURL) return msg.say('This user has no avatar.'); let images = []; images.push(Jimp.read(avatarURL)); images.push(Jimp.read('https://i.imgur.com/71qLwPf.png')); @@ -36,9 +34,9 @@ module.exports = class BeautifulCommand extends Command { grunkle.composite(avatar, 341, 35); grunkle.composite(avatar, 342, 301); grunkle.getBuffer(Jimp.MIME_PNG, (err, buff) => { - if(err) return msg.say(`An Error Occurred: ${err}`); + if (err) return msg.say(`An Error Occurred: ${err}`); return msg.channel.send({ files: [{ attachment: buff, name: 'beautiful.png' }] }) - .catch(err => msg.say(`An Error Occurred: ${err}`)); + .catch (err => msg.say(`An Error Occurred: ${err}`)); }); } }; diff --git a/commands/avataredit/bobross.js b/commands/avataredit/bobross.js index a0e02897..e42351ba 100644 --- a/commands/avataredit/bobross.js +++ b/commands/avataredit/bobross.js @@ -5,9 +5,7 @@ module.exports = class BobRossCommand extends Command { constructor(client) { super(client, { name: 'bob-ross', - aliases: [ - 'ross' - ], + aliases: ['ross'], group: 'avataredit', memberName: 'bob-ross', description: 'Make Bob Ross draw an avatar.', @@ -22,12 +20,12 @@ module.exports = class BobRossCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) return msg.say('This Command requires the `Attach Files` Permission.'); const { user } = args; const avatarURL = user.avatarURL('png', 2048); - if(!avatarURL) return msg.say('This user has no avatar.'); + if (!avatarURL) return msg.say('This user has no avatar.'); const blank = new Jimp(600, 775, 0xFFFFFFFF); let images = []; images.push(Jimp.read(avatarURL)); @@ -38,9 +36,9 @@ module.exports = class BobRossCommand extends Command { blank.composite(avatar, 44, 85); blank.composite(bob, 0, 0); blank.getBuffer(Jimp.MIME_PNG, (err, buff) => { - if(err) return msg.say(`An Error Occurred: ${err}`); + if (err) return msg.say(`An Error Occurred: ${err}`); return msg.channel.send({ files: [{ attachment: buff, name: 'bobross.png' }] }) - .catch(err => msg.say(`An Error Occurred: ${err}`)); + .catch (err => msg.say(`An Error Occurred: ${err}`)); }); } }; diff --git a/commands/avataredit/greyscale.js b/commands/avataredit/greyscale.js index 9862dcb5..106191c8 100644 --- a/commands/avataredit/greyscale.js +++ b/commands/avataredit/greyscale.js @@ -5,9 +5,7 @@ module.exports = class GreyscaleCommand extends Command { constructor(client) { super(client, { name: 'greyscale', - aliases: [ - 'grayscale' - ], + aliases: ['grayscale'], group: 'avataredit', memberName: 'greyscale', description: 'Greyscale a user\'s avatar colors.', @@ -22,18 +20,18 @@ module.exports = class GreyscaleCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) return msg.say('This Command requires the `Attach Files` Permission.'); const { user } = args; const avatarURL = user.avatarURL('png', 2048); - if(!avatarURL) return msg.say('This user has no avatar.'); + if (!avatarURL) return msg.say('This user has no avatar.'); const avatar = await Jimp.read(avatarURL); avatar.greyscale(); avatar.getBuffer(Jimp.MIME_PNG, (err, buff) => { - if(err) return msg.say(`An Error Occurred: ${err}`); + if (err) return msg.say(`An Error Occurred: ${err}`); return msg.channel.send({ files: [{ attachment: buff, name: 'greyscale.png' }] }) - .catch(err => msg.say(`An Error Occurred: ${err}`)); + .catch (err => msg.say(`An Error Occurred: ${err}`)); }); } }; diff --git a/commands/avataredit/invert.js b/commands/avataredit/invert.js index e362401a..37e34d19 100644 --- a/commands/avataredit/invert.js +++ b/commands/avataredit/invert.js @@ -19,18 +19,18 @@ module.exports = class InvertCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) return msg.say('This Command requires the `Attach Files` Permission.'); const { user } = args; const avatarURL = user.avatarURL('png', 2048); - if(!avatarURL) return msg.say('This user has no avatar.'); + if (!avatarURL) return msg.say('This user has no avatar.'); const avatar = await Jimp.read(avatarURL); avatar.invert(); avatar.getBuffer(Jimp.MIME_PNG, (err, buff) => { - if(err) return msg.say(`An Error Occurred: ${err}`); + if (err) return msg.say(`An Error Occurred: ${err}`); return msg.channel.send({ files: [{ attachment: buff, name: 'invert.png' }] }) - .catch(err => msg.say(`An Error Occurred: ${err}`)); + .catch (err => msg.say(`An Error Occurred: ${err}`)); }); } }; diff --git a/commands/avataredit/rip.js b/commands/avataredit/rip.js index 2d690566..56a2c562 100644 --- a/commands/avataredit/rip.js +++ b/commands/avataredit/rip.js @@ -5,10 +5,7 @@ module.exports = class RIPCommand extends Command { constructor(client) { super(client, { name: 'rip', - aliases: [ - 'grave', - 'grave-stone' - ], + aliases: ['grave', 'grave-stone'], group: 'avataredit', memberName: 'rip', description: 'Puts a user\'s avatar over a gravestone.', @@ -23,12 +20,12 @@ module.exports = class RIPCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) return msg.say('This Command requires the `Attach Files` Permission.'); const { user } = args; const avatarURL = user.avatarURL('png', 2048); - if(!avatarURL) return msg.say('This user has no avatar.'); + if (!avatarURL) return msg.say('This user has no avatar.'); let images = []; images.push(Jimp.read(avatarURL)); images.push(Jimp.read('https://i.imgur.com/KriteWm.jpg')); @@ -37,9 +34,9 @@ module.exports = class RIPCommand extends Command { avatar.resize(200, 200); grave.composite(avatar, 158, 51); grave.getBuffer(Jimp.MIME_PNG, (err, buff) => { - if(err) return msg.say(`An Error Occurred: ${err}`); + if (err) return msg.say(`An Error Occurred: ${err}`); return msg.channel.send({ files: [{ attachment: buff, name: 'rip.png' }] }) - .catch(err => msg.say(`An Error Occurred: ${err}`)); + .catch (err => msg.say(`An Error Occurred: ${err}`)); }); } }; diff --git a/commands/avataredit/steamcard.js b/commands/avataredit/steamcard.js index fae4650d..ffade4bf 100644 --- a/commands/avataredit/steamcard.js +++ b/commands/avataredit/steamcard.js @@ -5,9 +5,7 @@ module.exports = class SteamCardCommand extends Command { constructor(client) { super(client, { name: 'steam-card', - aliases: [ - 'card' - ], + aliases: ['card'], group: 'avataredit', memberName: 'steam-card', description: 'Put an avatar on a Steam Card.', @@ -22,13 +20,13 @@ module.exports = class SteamCardCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) return msg.say('This Command requires the `Attach Files` Permission.'); const { user } = args; const username = msg.guild ? msg.guild.member(user).displayName : user.username; const avatarURL = user.avatarURL('png', 2048); - if(!avatarURL) return msg.say('This user has no avatar.'); + if (!avatarURL) return msg.say('This user has no avatar.'); const blank = new Jimp(494, 568, 0xFFFFFFFF); let images = []; images.push(Jimp.read(avatarURL)); @@ -40,9 +38,9 @@ module.exports = class SteamCardCommand extends Command { blank.composite(card, 0, 0); blank.print(font, 38, 20, username); blank.getBuffer(Jimp.MIME_PNG, (err, buff) => { - if(err) return msg.say(`An Error Occurred: ${err}`); + if (err) return msg.say(`An Error Occurred: ${err}`); return msg.channel.send({ files: [{ attachment: buff, name: 'steamcard.png' }] }) - .catch(err => msg.say(`An Error Occurred: ${err}`)); + .catch (err => msg.say(`An Error Occurred: ${err}`)); }); } }; diff --git a/commands/avataredit/triggered.js b/commands/avataredit/triggered.js index 6dc7fac7..b990e160 100644 --- a/commands/avataredit/triggered.js +++ b/commands/avataredit/triggered.js @@ -19,12 +19,12 @@ module.exports = class TriggeredCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) return msg.say('This Command requires the `Attach Files` Permission.'); const { user } = args; const avatarURL = user.avatarURL('png', 2048); - if(!avatarURL) return msg.say('This user has no avatar.'); + if (!avatarURL) return msg.say('This user has no avatar.'); const blank = new Jimp(320, 371, 0xFFFFFFFF); let images = []; images.push(Jimp.read(avatarURL)); @@ -34,9 +34,9 @@ module.exports = class TriggeredCommand extends Command { blank.composite(avatar, 0, 0); blank.composite(triggered, 0, 0); blank.getBuffer(Jimp.MIME_PNG, (err, buff) => { - if(err) return msg.say(`An Error Occurred: ${err}`); + if (err) return msg.say(`An Error Occurred: ${err}`); return msg.channel.send({ files: [{ attachment: buff, name: 'triggered.png' }] }) - .catch(err => msg.say(`An Error Occurred: ${err}`)); + .catch (err => msg.say(`An Error Occurred: ${err}`)); }); } }; diff --git a/commands/avataredit/wanted.js b/commands/avataredit/wanted.js index 349e067e..b8e9e086 100644 --- a/commands/avataredit/wanted.js +++ b/commands/avataredit/wanted.js @@ -19,12 +19,12 @@ module.exports = class WantedCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) return msg.say('This Command requires the `Attach Files` Permission.'); const { user } = args; const avatarURL = user.avatarURL('png', 2048); - if(!avatarURL) return msg.say('This user has no avatar.'); + if (!avatarURL) return msg.say('This user has no avatar.'); let images = []; images.push(Jimp.read(avatarURL)); images.push(Jimp.read('https://i.imgur.com/ca09TG5.jpg')); @@ -32,9 +32,9 @@ module.exports = class WantedCommand extends Command { avatar.resize(500, 500); wanted.composite(avatar, 189, 438); wanted.getBuffer(Jimp.MIME_PNG, (err, buff) => { - if(err) return msg.say(`An Error Occurred: ${err}`); + if (err) return msg.say(`An Error Occurred: ${err}`); return msg.channel.send({ files: [{ attachment: buff, name: 'wanted.png' }] }) - .catch(err => msg.say(`An Error Occurred: ${err}`)); + .catch (err => msg.say(`An Error Occurred: ${err}`)); }); } }; diff --git a/commands/games/lottery.js b/commands/games/lottery.js index 0be99a1c..4ed4c36b 100644 --- a/commands/games/lottery.js +++ b/commands/games/lottery.js @@ -12,7 +12,7 @@ module.exports = class LotteryCommand extends Command { run(msg) { const lottery = Math.floor(Math.random() * 100) + 1; - if(lottery < 99) return msg.say(`Nope, sorry ${msg.author.username}, you lost.`); + if (lottery < 99) return msg.say(`Nope, sorry ${msg.author.username}, you lost.`); return msg.say(`Wow ${msg.author.username}! You actually won! Great job!`); } }; diff --git a/commands/games/mathgame.js b/commands/games/mathgame.js index d1af6336..b6e0e482 100644 --- a/commands/games/mathgame.js +++ b/commands/games/mathgame.js @@ -16,7 +16,7 @@ module.exports = class MathGameCommand extends Command { prompt: 'What should the difficulty of the game be? `Easy`, `Medium`, `Hard`, `Extreme`, or `Impossible`?', type: 'string', validate: difficulty => { - if(['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase())) return true; + if (['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase())) return true; return 'The difficulty must be either `easy`, `medium`, `hard`, `extreme`, or `impossible`.'; }, parse: difficulty => difficulty.toLowerCase() @@ -26,8 +26,8 @@ module.exports = class MathGameCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { difficulty } = args; const operation = operations[Math.floor(Math.random() * operations.length)]; @@ -61,10 +61,10 @@ module.exports = class MathGameCommand extends Command { time: 10000, errors: ['time'] }); - if(collected.first().content !== solved) + if (collected.first().content !== solved) return msg.say(`Nope! The correct answer is: ${solved}.`); return msg.say(`Perfect! ${solved} is the correct answer!`); - } catch(err) { + } catch (err) { return msg.say(`Time! The correct answer is ${solved}.`); } } diff --git a/commands/games/quiz.js b/commands/games/quiz.js index 2065c21b..175f6a3f 100644 --- a/commands/games/quiz.js +++ b/commands/games/quiz.js @@ -7,9 +7,7 @@ module.exports = class QuizCommand extends Command { constructor(client) { super(client, { name: 'quiz', - aliases: [ - 'jeopardy' - ], + aliases: ['jeopardy'], group: 'games', memberName: 'quiz', description: 'Answer a quiz question.' @@ -17,8 +15,8 @@ module.exports = class QuizCommand extends Command { } async run(msg) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); try { const { body } = await request @@ -37,13 +35,13 @@ module.exports = class QuizCommand extends Command { time: 15000, errors: ['time'] }); - if(collected.first().content.toLowerCase() !== answer) + if (collected.first().content.toLowerCase() !== answer) return msg.say(`The correct answer is: ${answer}.`); return msg.say(`Perfect! The correct answer is: ${answer}.`); - } catch(err) { + } catch (err) { return msg.say(`Time! The correct answer is: ${answer}`); } - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}.`); } } diff --git a/commands/games/rockpaperscissors.js b/commands/games/rockpaperscissors.js index c428820b..631a25de 100644 --- a/commands/games/rockpaperscissors.js +++ b/commands/games/rockpaperscissors.js @@ -5,9 +5,7 @@ module.exports = class RockPaperScissorsCommand extends Command { constructor(client) { super(client, { name: 'rock-paper-scissors', - aliases: [ - 'rps' - ], + aliases: ['rps'], group: 'games', memberName: 'rock-paper-scissors', description: 'Play Rock-Paper-Scissors.', @@ -17,7 +15,7 @@ module.exports = class RockPaperScissorsCommand extends Command { prompt: '`Rock`, `Paper`, or `Scissors`?', type: 'string', validate: choice => { - if(['rock', 'paper', 'scissors'].includes(choice.toLowerCase())) return true; + if (['rock', 'paper', 'scissors'].includes(choice.toLowerCase())) return true; return 'Please enter either `rock`, `paper`, or `scissors`.'; }, parse: choice => choice.toLowerCase() @@ -29,18 +27,18 @@ module.exports = class RockPaperScissorsCommand extends Command { run(msg, args) { const { choice } = args; const response = responses[Math.floor(Math.random() * responses.length)]; - if(choice === 'rock') { - if(response === 'Rock') return msg.say('Rock! Aw, it\'s a tie!'); - if(response === 'Paper') return msg.say('Paper! Yes! I win!'); - if(response === 'Scissors') return msg.say('Scissors! Aw... I lose...'); - } else if(choice === 'paper') { - if(response === 'Rock') return msg.say('Rock! Aw... I lose...'); - if(response === 'Paper') return msg.say('Paper! Aw, it\'s a tie!'); - if(response === 'Scissors') return msg.say('Scissors! Yes! I win!'); - } else if(choice === 'scissors') { - if(response === 'Rock') return msg.say('Rock! Yes! I win!'); - if(response === 'Paper') return msg.say('Paper! Aw... I lose...'); - if(response === 'Scissors') return msg.say('Scissors! Aw, it\'s a tie!'); + if (choice === 'rock') { + if (response === 'Rock') return msg.say('Rock! Aw, it\'s a tie!'); + if (response === 'Paper') return msg.say('Paper! Yes! I win!'); + if (response === 'Scissors') return msg.say('Scissors! Aw... I lose...'); + } else if (choice === 'paper') { + if (response === 'Rock') return msg.say('Rock! Aw... I lose...'); + if (response === 'Paper') return msg.say('Paper! Aw, it\'s a tie!'); + if (response === 'Scissors') return msg.say('Scissors! Yes! I win!'); + } else if (choice === 'scissors') { + if (response === 'Rock') return msg.say('Rock! Yes! I win!'); + if (response === 'Paper') return msg.say('Paper! Aw... I lose...'); + if (response === 'Scissors') return msg.say('Scissors! Aw, it\'s a tie!'); } } }; diff --git a/commands/games/slots.js b/commands/games/slots.js index 5aa88e78..62fe0184 100644 --- a/commands/games/slots.js +++ b/commands/games/slots.js @@ -16,7 +16,7 @@ module.exports = class SlotsCommand extends Command { 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)]; - if(slotOne === slotTwo && slotOne === slotThree) + if (slotOne === slotTwo && slotOne === slotThree) return msg.say(stripIndents` ${slotOne}|${slotTwo}|${slotThree} Wow! You won! Great job... er... luck! diff --git a/commands/games/typinggame.js b/commands/games/typinggame.js index e68942a5..040329d6 100644 --- a/commands/games/typinggame.js +++ b/commands/games/typinggame.js @@ -15,7 +15,7 @@ module.exports = class TypingGameCommand extends Command { prompt: 'What should the difficulty of the game be? `Easy`, `Medium`, `Hard`, `Extreme`, or `Impossible`?', type: 'string', validate: difficulty => { - if(['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase())) return true; + if (['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase())) return true; return 'The difficulty must be either `easy`, `medium`, `hard`, `extreme`, or `impossible`.'; }, parse: difficulty => difficulty.toLowerCase() @@ -25,8 +25,8 @@ module.exports = class TypingGameCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { difficulty } = args; const sentence = sentences[Math.floor(Math.random() * sentences.length)]; @@ -58,10 +58,10 @@ module.exports = class TypingGameCommand extends Command { time: time, errors: ['time'] }); - if(collected.first().content !== sentence) + if (collected.first().content !== sentence) return msg.say('Nope, your sentence does not match the original. Try again next time!'); return msg.say(`Good Job! You won!`); - } catch(err) { + } catch (err) { return msg.say('Time! Try again next time!'); } } diff --git a/commands/guildinfo/guildinfo.js b/commands/guildinfo/guildinfo.js index 4eacb7a8..85437b1f 100644 --- a/commands/guildinfo/guildinfo.js +++ b/commands/guildinfo/guildinfo.js @@ -8,11 +8,7 @@ module.exports = class GuildInfoCommand extends Command { constructor(client) { super(client, { name: 'server', - aliases: [ - 'guild', - 'server-info', - 'guild-info' - ], + aliases: ['guild', 'server-info', 'guild-info'], group: 'guildinfo', memberName: 'server', description: 'Gives some info on the current server.', @@ -21,7 +17,7 @@ module.exports = class GuildInfoCommand extends Command { } run(msg) { - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const embed = new RichEmbed() .setColor(0x00AE86) diff --git a/commands/moderation/ban.js b/commands/moderation/ban.js index 7ac5117d..29b0ebcd 100644 --- a/commands/moderation/ban.js +++ b/commands/moderation/ban.js @@ -6,9 +6,7 @@ module.exports = class BanCommand extends Command { constructor(client) { super(client, { name: 'ban', - aliases: [ - 'banne' - ], + aliases: ['banne'], group: 'moderation', memberName: 'ban', description: 'Bans a user and logs the ban to the mod logs.', @@ -24,7 +22,7 @@ module.exports = class BanCommand extends Command { prompt: 'What do you want to set the reason as?', type: 'string', validate: reason => { - if(reason.length < 140) return true; + if (reason.length < 140) return true; return 'Invalid Reason. Reason must be under 140 characters.'; } } @@ -37,23 +35,23 @@ module.exports = class BanCommand extends Command { } async run(msg, args) { - if(!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS')) + if (!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS')) return msg.say('This Command requires the `Ban Members` Permission.'); const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog')); - if(!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.'); - if(!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) + if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.'); + if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) return msg.say('This Command requires the `Send Messages` Permission for the Mod Log Channel.'); - if(!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { member, reason } = args; - if(!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?'); + if (!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?'); try { try { await member.send(stripIndents` You were banned from ${msg.guild.name}! Reason: ${reason}. `); - } catch(err) { + } catch (err) { await msg.say('Failed to send DM to the user.'); } await member.ban({ days: 7, reason }); @@ -68,7 +66,7 @@ module.exports = class BanCommand extends Command { **Reason:** ${reason} `); return modlogs.send({ embed }); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/moderation/kick.js b/commands/moderation/kick.js index 94e7f524..c01239e3 100644 --- a/commands/moderation/kick.js +++ b/commands/moderation/kick.js @@ -21,7 +21,7 @@ module.exports = class KickCommand extends Command { prompt: 'What do you want to set the reason as?', type: 'string', validate: reason => { - if(reason.length < 140) return true; + if (reason.length < 140) return true; return 'Invalid Reason. Reason must be under 140 characters.'; } } @@ -34,23 +34,23 @@ module.exports = class KickCommand extends Command { } async run(msg, args) { - if(!msg.channel.permissionsFor(this.client.user).has('KICK_MEMBERS')) + if (!msg.channel.permissionsFor(this.client.user).has('KICK_MEMBERS')) return msg.say('This Command requires the `Kick Members` Permission.'); const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog')); - if(!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.'); - if(!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) + if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.'); + if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) return msg.say('This Command requires the `Send Messages` Permission for the Mod Log Channel.'); - if(!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { member, reason } = args; - if(!member.kickable) return msg.say('This member is not kickable. Perhaps they have a higher role than me?'); + if (!member.kickable) return msg.say('This member is not kickable. Perhaps they have a higher role than me?'); try { try { await member.send(stripIndents` You were kicked from ${msg.guild.name}! Reason: ${reason}. `); - } catch(err) { + } catch (err) { await msg.say('Failed to send DM.'); } await member.kick({ reason }); @@ -65,7 +65,7 @@ module.exports = class KickCommand extends Command { **Reason:** ${reason} `); return modlogs.send({ embed }); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/moderation/lockdown.js b/commands/moderation/lockdown.js index d08373fd..bc408017 100644 --- a/commands/moderation/lockdown.js +++ b/commands/moderation/lockdown.js @@ -15,7 +15,7 @@ module.exports = class LockdownCommand extends Command { prompt: 'Please enter either `start` or `stop`.', type: 'string', validate: type => { - if(['start', 'stop'].includes(type.toLowerCase())) return true; + if (['start', 'stop'].includes(type.toLowerCase())) return true; return 'Please enter either `start` or `stop`.'; }, parse: type => type.toLowerCase() @@ -29,24 +29,24 @@ module.exports = class LockdownCommand extends Command { } async run(msg, args) { - if(!msg.channel.permissionsFor(this.client.user).has('ADMINISTRATOR')) + if (!msg.channel.permissionsFor(this.client.user).has('ADMINISTRATOR')) return msg.say('This Command requires the `Administrator` Permission.'); const { type } = args; - if(type === 'start') { + if (type === 'start') { try { await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: false }); return msg.say(stripIndents` Lockdown Started, users without Administrator can no longer post messages. Please use \`lockdown stop\` to end the lockdown. `); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } - } else if(type === 'stop') { + } else if (type === 'stop') { try { await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: true }); return msg.say('Lockdown Ended, users without Administrator can now post messages.'); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/moderation/prune.js b/commands/moderation/prune.js index b0301784..292f646d 100644 --- a/commands/moderation/prune.js +++ b/commands/moderation/prune.js @@ -19,7 +19,7 @@ module.exports = class PruneCommand extends Command { prompt: 'How many messages do you want to delete? Limit of up to 99.', type: 'integer', validate: count => { - if(count < 100 && count > 0) return true; + if (count < 100 && count > 0) return true; return 'Invalid Count. Count must be from 1-99.'; } } @@ -32,16 +32,16 @@ module.exports = class PruneCommand extends Command { } async run(msg, args) { - if(!msg.channel.permissionsFor(this.client.user).has('READ_MESSAGE_HISTORY')) + if (!msg.channel.permissionsFor(this.client.user).has('READ_MESSAGE_HISTORY')) return msg.say('This Command requires the `Read Message History` Permission.'); - if(!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES')) + if (!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES')) return msg.say('This Command requires the `Manage Messages` Permission.'); const { count } = args; try { const messages = await msg.channel.fetchMessages({ limit: count + 1 }); await msg.channel.bulkDelete(messages, true); return null; - } catch(err) { + } catch (err) { return msg.say('There are no messages younger than two weeks that can be deleted.'); } } diff --git a/commands/moderation/softban.js b/commands/moderation/softban.js index ea737128..c3164d2c 100644 --- a/commands/moderation/softban.js +++ b/commands/moderation/softban.js @@ -6,6 +6,7 @@ module.exports = class SoftbanCommand extends Command { constructor(client) { super(client, { name: 'softban', + aliases: ['softbanne'], group: 'moderation', memberName: 'softban', description: 'Kicks a user and deletes their messages, and logs the softban to the mod logs.', @@ -21,7 +22,7 @@ module.exports = class SoftbanCommand extends Command { prompt: 'What do you want to set the reason as?', type: 'string', validate: reason => { - if(reason.length < 140) return true; + if (reason.length < 140) return true; return 'Invalid Reason. Reason must be under 140 characters.'; } } @@ -34,25 +35,25 @@ module.exports = class SoftbanCommand extends Command { } async run(msg, args) { - if(!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS')) + if (!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS')) return msg.say('This Command requires the `Ban Members` Permission.'); - if(!msg.channel.permissionsFor(this.client.user).has('KICK_MEMBERS')) + if (!msg.channel.permissionsFor(this.client.user).has('KICK_MEMBERS')) return msg.say('This Command requires the `Kick Members` Permission.'); const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog')); - if(!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.'); - if(!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) + if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.'); + if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) return msg.say('This Command requires the `Send Messages` Permission for the Mod Log Channel.'); - if(!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { member, reason } = args; - if(!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?'); + if (!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?'); try { try { await member.send(stripIndents` You were softbanned from ${msg.guild.name}! Reason: ${reason}. `); - } catch(err) { + } catch (err) { await msg.say('Failed to send DM to user.'); } await member.ban({ days: 7, reason }); @@ -68,7 +69,7 @@ module.exports = class SoftbanCommand extends Command { **Reason:** ${reason} `); return modlogs.send({ embed }); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/moderation/unban.js b/commands/moderation/unban.js index 72b9bbe9..0250b450 100644 --- a/commands/moderation/unban.js +++ b/commands/moderation/unban.js @@ -6,9 +6,7 @@ module.exports = class UnbanCommand extends Command { constructor(client) { super(client, { name: 'unban', - aliases: [ - 'unbanne' - ], + aliases: ['unbanne'], group: 'moderation', memberName: 'unban', description: 'Unbans a user and logs the unban to the mod logs.', @@ -19,7 +17,7 @@ module.exports = class UnbanCommand extends Command { prompt: 'What member do you want to unban? Please enter the ID of the user.', type: 'string', validate: id => { - if(id.length === 18) return true; + if (id.length === 18) return true; return 'Invalid ID.'; } }, @@ -28,7 +26,7 @@ module.exports = class UnbanCommand extends Command { prompt: 'What do you want to set the reason as?', type: 'string', validate: reason => { - if(reason.length < 140) return true; + if (reason.length < 140) return true; return 'Invalid Reason. Reason must be under 140 characters.'; } } @@ -41,17 +39,17 @@ module.exports = class UnbanCommand extends Command { } async run(msg, args) { - if(!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS')) + if (!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS')) return msg.say('This Command requires the `Ban Members` Permission.'); const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog')); - if(!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.'); - if(!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) + if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.'); + if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) return msg.say('This Command requires the `Send Messages` Permission for the Mod Log Channel.'); - if(!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { id, reason } = args; const bans = await msg.guild.fetchBans(); - if(!bans.has(id)) return msg.say('This ID is not in the Guild Banlist.'); + if (!bans.has(id)) return msg.say('This ID is not in the Guild Banlist.'); const member = bans.get(id); try { await msg.guild.unban(member); @@ -66,7 +64,7 @@ module.exports = class UnbanCommand extends Command { **Reason:** ${reason} `); return modlogs.send({ embed }); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/moderation/warn.js b/commands/moderation/warn.js index f532b081..2a74812f 100644 --- a/commands/moderation/warn.js +++ b/commands/moderation/warn.js @@ -21,7 +21,7 @@ module.exports = class WarnCommand extends Command { prompt: 'What do you want to set the reason as?', type: 'string', validate: reason => { - if(reason.length < 140) return true; + if (reason.length < 140) return true; return 'Invalid Reason. Reason must be under 140 characters.'; } } @@ -35,10 +35,10 @@ module.exports = class WarnCommand extends Command { async run(msg, args) { const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog')); - if(!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.'); - if(!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) + if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.'); + if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) return msg.say('This Command requires the `Send Messages` Permission for the Mod Log Channel.'); - if(!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { member, reason } = args; try { @@ -53,7 +53,7 @@ module.exports = class WarnCommand extends Command { **Reason:** ${reason} `); return modlogs.send({ embed }); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/numedit/currency.js b/commands/numedit/currency.js index cb8831f7..6ef253ea 100644 --- a/commands/numedit/currency.js +++ b/commands/numedit/currency.js @@ -16,7 +16,7 @@ module.exports = class CurrencyCommand extends Command { prompt: 'What currency code do you want to use as the base?', type: 'string', validate: base => { - if(codes.includes(base.toUpperCase())) return true; + if (codes.includes(base.toUpperCase())) return true; return 'Invalid Currency Code. Use `help currency` to view a list of currency codes.'; }, parse: base => base.toUpperCase() @@ -26,7 +26,7 @@ module.exports = class CurrencyCommand extends Command { prompt: 'What currency code do you want to convert to?', type: 'string', validate: to => { - if(codes.includes(to.toUpperCase())) return true; + if (codes.includes(to.toUpperCase())) return true; return 'Invalid Currency Code. Use `help currency` to view a list of currency codes.'; }, parse: to => to.toUpperCase() @@ -42,13 +42,13 @@ module.exports = class CurrencyCommand extends Command { async run(msg, args) { const { base, to, amount } = args; - if(base === to) return msg.say(`Converting ${base} to ${to} is the same value, dummy.`); + if (base === to) return msg.say(`Converting ${base} to ${to} is the same value, dummy.`); try { const { body } = await request .get(`http://api.fixer.io/latest?base=${base}&symbols=${to}`); const rate = body.rates[to]; return msg.say(`${amount} ${base} is ${amount * rate} ${to}.`); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/numedit/math.js b/commands/numedit/math.js index f873feb1..7c17ba5f 100644 --- a/commands/numedit/math.js +++ b/commands/numedit/math.js @@ -24,7 +24,7 @@ module.exports = class MathCommand extends Command { const solved = math.eval(expression); return msg.say(solved) .catch(() => msg.say('Invalid statement.')); - } catch(err) { + } catch (err) { return msg.say('Invalid statement.'); } } diff --git a/commands/numedit/temperature.js b/commands/numedit/temperature.js index 3fae37af..6557426b 100644 --- a/commands/numedit/temperature.js +++ b/commands/numedit/temperature.js @@ -13,7 +13,7 @@ module.exports = class TemperatureCommand extends Command { prompt: 'What temperature unit do you want to use as the base?', type: 'string', validate: base => { - if(['celsius', 'fahrenheit', 'kelvin'].includes(base.toLowerCase())) return true; + if (['celsius', 'fahrenheit', 'kelvin'].includes(base.toLowerCase())) return true; return 'Please enter either `celsius`, `fahrenheit`, or `kelvin`.'; }, parse: base => base.toLowerCase() @@ -23,7 +23,7 @@ module.exports = class TemperatureCommand extends Command { prompt: 'What temperature unit do you want to convert to?', type: 'string', validate: to => { - if(['celsius', 'fahrenheit', 'kelvin'].includes(to.toLowerCase())) return true; + if (['celsius', 'fahrenheit', 'kelvin'].includes(to.toLowerCase())) return true; return 'Please enter either `celsius`, `fahrenheit`, or `kelvin`.'; }, parse: to => to.toLowerCase() @@ -39,16 +39,16 @@ module.exports = class TemperatureCommand extends Command { run(msg, args) { const { base, to, amount } = args; - if(base === to) return msg.say(`Converting ${base} to ${to} is the same value, dummy.`); - if(base === 'celsius') { - if(to === 'fahrenheit') return msg.say(`${amount}°C is ${(amount * 1.8) + 32}°F.`); - if(to === 'kelvin') return msg.say(`${amount}°C is ${amount + 273.15}°K.`); - } else if(base === 'fahrenheit') { - if(to === 'celsius') return msg.say(`${amount}°F is ${(amount - 32) / 1.8}°C.`); - if(to === 'kelvin') return msg.say(`${amount}°F is ${(amount + 459.67) * (5 / 9)}°K.`); - } else if(base === 'kelvin') { - if(to === 'celsius') return msg.say(`${amount}°K is ${amount - 273.15}°C.`); - if(to === 'fahrenheit') return msg.say(`${amount}°K is ${(amount * 1.8) - 459.67}°F.`); + if (base === to) return msg.say(`Converting ${base} to ${to} is the same value, dummy.`); + if (base === 'celsius') { + if (to === 'fahrenheit') return msg.say(`${amount}°C is ${(amount * 1.8) + 32}°F.`); + if (to === 'kelvin') return msg.say(`${amount}°C is ${amount + 273.15}°K.`); + } else if (base === 'fahrenheit') { + if (to === 'celsius') return msg.say(`${amount}°F is ${(amount - 32) / 1.8}°C.`); + if (to === 'kelvin') return msg.say(`${amount}°F is ${(amount + 459.67) * (5 / 9)}°K.`); + } else if (base === 'kelvin') { + if (to === 'celsius') return msg.say(`${amount}°K is ${amount - 273.15}°C.`); + if (to === 'fahrenheit') return msg.say(`${amount}°K is ${(amount * 1.8) - 459.67}°F.`); } } }; diff --git a/commands/random/easteregg.js b/commands/random/easteregg.js index 3a41b13c..13f6303a 100644 --- a/commands/random/easteregg.js +++ b/commands/random/easteregg.js @@ -5,9 +5,7 @@ module.exports = class EasterEggCommand extends Command { constructor(client) { super(client, { name: 'easter-egg', - aliases: [ - 'tag' - ], + aliases: ['tag'], group: 'random', memberName: 'easter-egg', description: 'Can you discover all the easter eggs?', @@ -17,7 +15,7 @@ module.exports = class EasterEggCommand extends Command { prompt: 'What easter egg do you want to view?', type: 'string', validate: tag => { - if(eastereggs[tag.toLowerCase()]) return true; + if (eastereggs[tag.toLowerCase()]) return true; return 'Nope, that\'s not a valid easter egg. Try again!'; }, parse: tag => tag.toLowerCase() diff --git a/commands/random/meme.js b/commands/random/meme.js index 6c1f3474..dca5f137 100644 --- a/commands/random/meme.js +++ b/commands/random/meme.js @@ -15,7 +15,7 @@ module.exports = class MemeCommand extends Command { prompt: 'What meme type do you want to use?', type: 'string', validate: type => { - if(codes.includes(type.toLowerCase())) return true; + if (codes.includes(type.toLowerCase())) return true; return 'Invalid meme type. Use `help meme` to view a list of meme types.'; }, parse: type => type.toLowerCase() @@ -37,11 +37,11 @@ module.exports = class MemeCommand extends Command { } run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) return msg.say('This Command requires the `Attach Files` Permission.'); const { type, top, bottom } = args; return msg.channel.send({ files: [`https://memegen.link/${type}/${top}/${bottom}.jpg`] }) - .catch(err => msg.say(`An Error Occurred: ${err}`)); + .catch (err => msg.say(`An Error Occurred: ${err}`)); } }; diff --git a/commands/random/nitro.js b/commands/random/nitro.js index 22b1327a..0b8ac3a2 100644 --- a/commands/random/nitro.js +++ b/commands/random/nitro.js @@ -13,8 +13,8 @@ module.exports = class NitroCommand extends Command { } run(msg) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const embed = new RichEmbed() .setAuthor('Discord Nitro') diff --git a/commands/random/spam.js b/commands/random/spam.js index 6364823f..69c4fd57 100644 --- a/commands/random/spam.js +++ b/commands/random/spam.js @@ -11,10 +11,10 @@ module.exports = class SpamCommand extends Command { } run(msg) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) return msg.say('This Command requires the `Attach Files` Permission.'); return msg.channel.send({ files: ['https://i.imgur.com/2JFu5xE.jpg'] }) - .catch(err => msg.say(`An Error Occurred: ${err}`)); + .catch (err => msg.say(`An Error Occurred: ${err}`)); } }; diff --git a/commands/random/strawpoll.js b/commands/random/strawpoll.js index 7b6da18d..2f466052 100644 --- a/commands/random/strawpoll.js +++ b/commands/random/strawpoll.js @@ -15,7 +15,7 @@ module.exports = class StrawpollCommand extends Command { prompt: 'What would you like the title of the Strawpoll to be?', type: 'string', validate: title => { - if(title.length < 200) return true; + if (title.length < 200) return true; return 'Invalid Title. Title must be under 200 characters.'; } }, @@ -25,7 +25,7 @@ module.exports = class StrawpollCommand extends Command { type: 'string', infinite: true, validate: choice => { - if(choice.length < 160) return true; + if (choice.length < 160) return true; return 'Invalid Choice. Choices must be under 140 characters each.'; } } @@ -35,8 +35,8 @@ module.exports = class StrawpollCommand extends Command { async run(msg, args) { const { title, options } = args; - if(options.length < 2) return msg.say('You provided less than two choices.'); - if(options.length > 31) return msg.say('You provided more than thirty choices.'); + if (options.length < 2) return msg.say('You provided less than two choices.'); + if (options.length > 31) return msg.say('You provided more than thirty choices.'); try { const { body } = await request .post('https://strawpoll.me/api/v2/polls') @@ -45,7 +45,7 @@ module.exports = class StrawpollCommand extends Command { ${body.title} http://strawpoll.me/${body.id} `); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/random/today.js b/commands/random/today.js index fb53924c..412eeb9b 100644 --- a/commands/random/today.js +++ b/commands/random/today.js @@ -13,8 +13,8 @@ module.exports = class TodayCommand extends Command { } async run(msg) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); try { const { text } = await request @@ -30,7 +30,7 @@ module.exports = class TodayCommand extends Command { .setTimestamp() .setDescription(`${events[random].year}: ${events[random].text}`); return msg.embed(embed); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/random/wouldyourather.js b/commands/random/wouldyourather.js index a313ae1e..787926dc 100644 --- a/commands/random/wouldyourather.js +++ b/commands/random/wouldyourather.js @@ -6,9 +6,7 @@ module.exports = class WouldYouRatherCommand extends Command { constructor(client) { super(client, { name: 'would-you-rather', - aliases: [ - 'wyrather' - ], + aliases: ['wyrather'], group: 'random', memberName: 'would-you-rather', description: 'Gets a random would you rather question.' @@ -16,8 +14,8 @@ module.exports = class WouldYouRatherCommand extends Command { } async run(msg) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); try { const { body } = await request @@ -28,7 +26,7 @@ module.exports = class WouldYouRatherCommand extends Command { .setColor(0x9797FF) .setDescription(`${body.choicea} OR ${body.choiceb}?`); return msg.embed(embed); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/randomimg/cat.js b/commands/randomimg/cat.js index 66917a94..9478cca3 100644 --- a/commands/randomimg/cat.js +++ b/commands/randomimg/cat.js @@ -5,9 +5,7 @@ module.exports = class CatCommand extends Command { constructor(client) { super(client, { name: 'cat', - aliases: [ - 'neko' - ], + aliases: ['neko'], group: 'randomimg', memberName: 'cat', description: 'Sends a random cat image.' @@ -15,15 +13,15 @@ module.exports = class CatCommand extends Command { } async run(msg) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) return msg.say('This Command requires the `Attach Files` Permission.'); try { const { body } = await request .get('http://random.cat/meow'); return msg.channel.send({ files: [body.file] }) - .catch(err => msg.say(`An Error Occurred: ${err}`)); - } catch(err) { + .catch (err => msg.say(`An Error Occurred: ${err}`)); + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/randomimg/dog.js b/commands/randomimg/dog.js index 0a012a5a..f8ec4f6b 100644 --- a/commands/randomimg/dog.js +++ b/commands/randomimg/dog.js @@ -12,15 +12,15 @@ module.exports = class DogCommand extends Command { } async run(msg) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) return msg.say('This Command requires the `Attach Files` Permission.'); try { const { body } = await request .get('https://random.dog/woof.json'); return msg.channel.send({ files: [body.url] }) - .catch(err => msg.say(`An Error Occurred: ${err}`)); - } catch(err) { + .catch (err => msg.say(`An Error Occurred: ${err}`)); + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/randomimg/xiaopai.js b/commands/randomimg/xiaopai.js index 47a961c5..9d4c88ed 100644 --- a/commands/randomimg/xiaopai.js +++ b/commands/randomimg/xiaopai.js @@ -5,9 +5,7 @@ module.exports = class XiaoCommand extends Command { constructor(client) { super(client, { name: 'xiao-pai', - aliases: [ - 'xiao' - ], + aliases: ['xiao'], group: 'randomimg', memberName: 'xiao-pai', description: 'Sends a random image of Xiao Pai.' @@ -15,11 +13,11 @@ module.exports = class XiaoCommand extends Command { } run(msg) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) return msg.say('This Command requires the `Attach Files` Permission.'); const xiao = xiaos[Math.floor(Math.random() * xiaos.length)]; return msg.channel.send({ files: [xiao] }) - .catch(err => msg.say(`An Error Occurred: ${err}`)); + .catch (err => msg.say(`An Error Occurred: ${err}`)); } }; diff --git a/commands/response/coin.js b/commands/response/coin.js index ed9146d5..7096b0c1 100644 --- a/commands/response/coin.js +++ b/commands/response/coin.js @@ -5,10 +5,7 @@ module.exports = class CoinFlipCommand extends Command { constructor(client) { super(client, { name: 'coin', - aliases: [ - 'coin-flip', - 'flip' - ], + aliases: ['coin-flip', 'flip'], group: 'response', memberName: 'coin', description: 'Flips a coin.' diff --git a/commands/response/name.js b/commands/response/name.js index 849913bd..51837f61 100644 --- a/commands/response/name.js +++ b/commands/response/name.js @@ -14,7 +14,7 @@ module.exports = class RandomNameCommand extends Command { prompt: 'Which gender do you want to generate a name for?', type: 'string', validate: gender => { - if(['male', 'female'].includes(gender.toLowerCase())) return true; + if (['male', 'female'].includes(gender.toLowerCase())) return true; return 'Please enter either `male` or `female`.'; }, parse: gender => gender.toLowerCase() @@ -26,10 +26,10 @@ module.exports = class RandomNameCommand extends Command { run(msg, args) { const { gender } = args; const lastName = lastNames[Math.floor(Math.random() * lastNames.length)]; - if(gender === 'male') { + if (gender === 'male') { const name = maleNames[Math.floor(Math.random() * maleNames.length)]; return msg.say(`${name} ${lastName}`); - } else if(gender === 'female') { + } else if (gender === 'female') { const name = femaleNames[Math.floor(Math.random() * femaleNames.length)]; return msg.say(`${name} ${lastName}`); } diff --git a/commands/response/quantumcoin.js b/commands/response/quantumcoin.js index fe7707bb..a001c4aa 100644 --- a/commands/response/quantumcoin.js +++ b/commands/response/quantumcoin.js @@ -5,9 +5,7 @@ module.exports = class QuantumCoinCommand extends Command { constructor(client) { super(client, { name: 'quantum-coin', - aliases: [ - 'qcoin' - ], + aliases: ['qcoin'], group: 'response', memberName: 'quantum-coin', description: 'Flips a coin that lands on nothing.' diff --git a/commands/response/ratewaifu.js b/commands/response/ratewaifu.js index 8d7aeee1..4451c7d6 100644 --- a/commands/response/ratewaifu.js +++ b/commands/response/ratewaifu.js @@ -4,9 +4,7 @@ module.exports = class RateWaifuCommand extends Command { constructor(client) { super(client, { name: 'rate-waifu', - aliases: [ - 'waifu' - ], + aliases: ['waifu'], group: 'response', memberName: 'rate-waifu', description: 'Rates your Waifu.', diff --git a/commands/response/roll.js b/commands/response/roll.js index 25870bfa..2f3c2a14 100644 --- a/commands/response/roll.js +++ b/commands/response/roll.js @@ -4,9 +4,7 @@ module.exports = class RollCommand extends Command { constructor(client) { super(client, { name: 'roll', - aliases: [ - 'dice' - ], + aliases: ['dice'], group: 'response', memberName: 'roll', description: 'Rolls a dice with a maximum value you specify.', diff --git a/commands/response/ship.js b/commands/response/ship.js index 0d7ce084..4468c1dd 100644 --- a/commands/response/ship.js +++ b/commands/response/ship.js @@ -4,9 +4,7 @@ module.exports = class ShipCommand extends Command { constructor(client) { super(client, { name: 'ship', - aliases: [ - 'rate' - ], + aliases: ['rate'], group: 'response', memberName: 'ship', description: 'Ships things/people together.', diff --git a/commands/search/botinfo.js b/commands/search/botinfo.js index bbadcada..a73c3b6a 100644 --- a/commands/search/botinfo.js +++ b/commands/search/botinfo.js @@ -20,8 +20,8 @@ module.exports = class BotSearchCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { bot } = args; try { @@ -41,7 +41,7 @@ module.exports = class BotSearchCommand extends Command { .addField('**Prefix:**', body.prefix, true); return msg.embed(embed); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/search/define.js b/commands/search/define.js index a26b26be..f5e7d68f 100644 --- a/commands/search/define.js +++ b/commands/search/define.js @@ -21,20 +21,20 @@ module.exports = class DefineCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { query } = args; try { const { body } = await request .get(`http://api.wordnik.com:80/v4/word.json/${query}/definitions?limit=1&includeRelated=false&useCanonical=false&api_key=${process.env.WORDNIK_KEY}`); - if(body.length === 0) throw new Error('No Results.'); + if (body.length === 0) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0x9797FF) .setTitle(body[0].word) .setDescription(body[0].text); return msg.embed(embed); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/search/discrim.js b/commands/search/discrim.js index e675cf1e..72116ce8 100644 --- a/commands/search/discrim.js +++ b/commands/search/discrim.js @@ -5,10 +5,7 @@ module.exports = class DiscrimCommand extends Command { constructor(client) { super(client, { name: 'discrim', - aliases: [ - 'discriminator', - 'search-discrim' - ], + aliases: ['discriminator', 'search-discrim'], group: 'search', memberName: 'discrim', description: 'Searches for other users with a certain discriminator.', @@ -18,7 +15,7 @@ module.exports = class DiscrimCommand extends Command { prompt: 'Which discriminator would you like to search for?', type: 'string', validate: discrim => { - if(/[0-9]+$/g.test(discrim) && discrim.length === 4) return true; + if (/[0-9]+$/g.test(discrim) && discrim.length === 4) return true; return `${discrim} is not a valid discriminator.`; } } @@ -27,8 +24,8 @@ module.exports = class DiscrimCommand extends Command { } run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { discrim } = args; const users = this.client.users.filter(u => u.discriminator === discrim).map(u => u.username).sort(); diff --git a/commands/search/forecast.js b/commands/search/forecast.js index 87f59c90..16d69cf3 100644 --- a/commands/search/forecast.js +++ b/commands/search/forecast.js @@ -20,14 +20,14 @@ module.exports = class ForecastCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { query } = args; try { const { body } = await request .get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${query}")&format=json`); - if(body.query.count === 0) throw new Error('Location Not Found.'); + if (body.query.count === 0) throw new Error('Location Not Found.'); const forecasts = body.query.results.channel.item.forecast; const embed = new RichEmbed() .setColor(0x0000FF) @@ -49,7 +49,7 @@ module.exports = class ForecastCommand extends Command { .addField(`**${forecasts[6].day} - ${forecasts[6].date}:**`, `**High:** ${forecasts[6].high}°F, **Low:** ${forecasts[6].low}°F, **Condition:** ${forecasts[6].text}`); return msg.embed(embed); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/search/google.js b/commands/search/google.js index 6a653960..320bd2e1 100644 --- a/commands/search/google.js +++ b/commands/search/google.js @@ -29,10 +29,10 @@ module.exports = class GoogleCommand extends Command { .get(`https://www.google.com/search?q=${query}`); const $ = cheerio.load(text); let href = $('.r').first().find('a').first().attr('href'); - if(!href) throw new Error('No Results.'); + if (!href) throw new Error('No Results.'); href = querystring.parse(href.replace('/url?', '')); return message.edit(href.q); - } catch(err) { + } catch (err) { return message.edit('An Error Occurred: No Results.'); } } diff --git a/commands/search/imdb.js b/commands/search/imdb.js index ca80fe48..731a00ef 100644 --- a/commands/search/imdb.js +++ b/commands/search/imdb.js @@ -21,14 +21,14 @@ module.exports = class IMDBCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { query } = args; try { const { body } = await request .get(`http://www.omdbapi.com/?t=${query}&plot=full`); - if(body.Error) throw new Error('No Results.'); + if (body.Error) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0xDBA628) .setAuthor('IMDB', 'https://i.imgur.com/sXwwIQs.png') @@ -50,7 +50,7 @@ module.exports = class IMDBCommand extends Command { .addField('**Actors:**', body.Actors); return msg.embed(embed); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/search/map.js b/commands/search/map.js index 46c96221..c3ed582a 100644 --- a/commands/search/map.js +++ b/commands/search/map.js @@ -15,7 +15,7 @@ module.exports = class MapCommand extends Command { prompt: 'What would you like the zoom level for the map to be? Limit 1-20.', type: 'integer', validate: zoom => { - if(zoom < 21 && zoom > 0) + if (zoom < 21 && zoom > 0) return true; return 'Please enter a zoom value from 1-20'; } @@ -31,16 +31,16 @@ module.exports = class MapCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) return msg.say('This Command requires the `Attach Files` Permission.'); const { zoom, query } = args; try { const { body } = await request .get(`https://maps.googleapis.com/maps/api/staticmap?center=${query}&zoom=${zoom}&size=500x500&key=${process.env.GOOGLE_KEY}`); return msg.channel.send({ files: [{ attachment: body, name: 'map.png' }] }) - .catch(err => msg.say(`An Error Occurred: ${err}`)); - } catch(err) { + .catch (err => msg.say(`An Error Occurred: ${err}`)); + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/search/neopet.js b/commands/search/neopet.js index 4e863915..a090382f 100644 --- a/commands/search/neopet.js +++ b/commands/search/neopet.js @@ -27,9 +27,9 @@ module.exports = class NeopetCommand extends Command { .get(`http://www.sunnyneo.com/petimagefinder.php?name=${query}&size=5&mood=1`); const $ = cheerio.load(text); const link = $('textarea').first().text(); - if(!link.includes('cp')) throw new Error('Invalid Pet Name.'); + if (!link.includes('cp')) throw new Error('Invalid Pet Name.'); return msg.say(link); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/search/osu.js b/commands/search/osu.js index 3004408a..21d9be69 100644 --- a/commands/search/osu.js +++ b/commands/search/osu.js @@ -21,14 +21,14 @@ module.exports = class OsuCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { query } = args; try { const { body } = await request .get(`https://osu.ppy.sh/api/get_user?k=${process.env.OSU_KEY}&u=${query}&type=string`); - if(body.length === 0) throw new Error('No Results.'); + if (body.length === 0) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0xFF66AA) .setAuthor('osu!', 'https://i.imgur.com/EmnUp00.png') @@ -58,7 +58,7 @@ module.exports = class OsuCommand extends Command { .addField('**A:**', body[0].count_rank_a, true); return msg.embed(embed); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/search/soundcloud.js b/commands/search/soundcloud.js index 095a8461..cdd32bc1 100644 --- a/commands/search/soundcloud.js +++ b/commands/search/soundcloud.js @@ -21,14 +21,14 @@ module.exports = class SoundCloudCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { query } = args; try { const { body } = await request .get(`https://api.soundcloud.com/tracks?q=${query}&client_id=${process.env.SOUNDCLOUD_KEY}`); - if(body.length === 0) throw new Error('No Results.'); + if (body.length === 0) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0xF15A22) .setAuthor(body[0].title, 'https://i.imgur.com/lFIz7RU.png') @@ -45,7 +45,7 @@ module.exports = class SoundCloudCommand extends Command { .addField('**Favorited Count:**', body[0].favoritings_count, true); return msg.embed(embed); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/search/urban.js b/commands/search/urban.js index cb5d8292..76a55e60 100644 --- a/commands/search/urban.js +++ b/commands/search/urban.js @@ -21,14 +21,14 @@ module.exports = class UrbanCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { query } = args; try { const { body } = await request .get(`http://api.urbandictionary.com/v0/define?term=${query}`); - if(body.list.length === 0) throw new Error('No Results.'); + if (body.list.length === 0) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0x32a8f0) .setAuthor('Urban Dictionary', 'https://i.imgur.com/fzFuuL7.png') @@ -38,7 +38,7 @@ module.exports = class UrbanCommand extends Command { .addField('**Example:**', body.list[0].example.substr(0, 2000) || 'None'); return msg.embed(embed); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/search/wattpad.js b/commands/search/wattpad.js index abce010b..ddcecdcf 100644 --- a/commands/search/wattpad.js +++ b/commands/search/wattpad.js @@ -21,15 +21,15 @@ module.exports = class WattpadCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { query } = args; try { const { body } = await request .get(`https://api.wattpad.com:443/v4/stories?query=${query}&limit=1`) .set({ 'Authorization': `Basic ${process.env.WATTPAD_KEY}` }); - if(body.stories.length === 0) throw new Error('No Results.'); + if (body.stories.length === 0) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0xF89C34) .setAuthor('Wattpad', 'https://i.imgur.com/Rw9vRQB.png') @@ -49,7 +49,7 @@ module.exports = class WattpadCommand extends Command { .addField('**Comments:**', body.stories[0].commentCount, true); return msg.embed(embed); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/search/weather.js b/commands/search/weather.js index bf5cd039..6e5951bf 100644 --- a/commands/search/weather.js +++ b/commands/search/weather.js @@ -20,14 +20,14 @@ module.exports = class WeatherCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { query } = args; try { const { body } = await request .get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${query}")&format=json`); - if(body.query.count === 0) throw new Error('Location Not Found.'); + if (body.query.count === 0) throw new Error('Location Not Found.'); const embed = new RichEmbed() .setColor(0x0000FF) .setAuthor(body.query.results.channel.title, 'https://i.imgur.com/2MT0ViC.png') @@ -58,7 +58,7 @@ module.exports = class WeatherCommand extends Command { .addField('**Wind Speed:**', body.query.results.channel.wind.speed, true); return msg.embed(embed); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/search/wikipedia.js b/commands/search/wikipedia.js index 6f5e92ab..bb77c856 100644 --- a/commands/search/wikipedia.js +++ b/commands/search/wikipedia.js @@ -21,14 +21,14 @@ module.exports = class WikipediaCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { query } = args; try { const { body } = await request .get(`https://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&titles=${query}&exintro=&explaintext=&redirects=&formatversion=2`); - if(body.query.pages[0].missing) throw new Error('No Results.'); + if (body.query.pages[0].missing) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0xE7E7E7) .setTitle(body.query.pages[0].title) @@ -36,7 +36,7 @@ module.exports = class WikipediaCommand extends Command { .setAuthor('Wikipedia', 'https://i.imgur.com/a4eeEhh.png') .setDescription(body.query.pages[0].extract.substr(0, 2000).replace(/[\n]/g, '\n\n')); return msg.embed(embed); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/search/youtube.js b/commands/search/youtube.js index 632fc71c..b9607658 100644 --- a/commands/search/youtube.js +++ b/commands/search/youtube.js @@ -21,14 +21,14 @@ module.exports = class YouTubeCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { query } = args; try { const { body } = await request .get(`https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&maxResults=1&q=${query}&key=${process.env.GOOGLE_KEY}`); - if(body.items.length === 0) throw new Error('No Results.'); + if (body.items.length === 0) throw new Error('No Results.'); const embed = new RichEmbed() .setColor(0xDD2825) .setTitle(body.items[0].snippet.title) @@ -37,7 +37,7 @@ module.exports = class YouTubeCommand extends Command { .setURL(`https://www.youtube.com/watch?v=${body.items[0].id.videoId}`) .setThumbnail(body.items[0].snippet.thumbnails.default.url); return msg.embed(embed); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/search/yugioh.js b/commands/search/yugioh.js index 9dad35c1..4bc5245c 100644 --- a/commands/search/yugioh.js +++ b/commands/search/yugioh.js @@ -21,15 +21,15 @@ module.exports = class YuGiOhCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { query } = args; try { const { body } = await request .get(`http://yugiohprices.com/api/card_data/${query}`); - if(body.status === 'fail') throw new Error('No Results.'); - if(body.data.card_type === 'monster') { + if (body.status === 'fail') throw new Error('No Results.'); + if (body.data.card_type === 'monster') { const embed = new RichEmbed() .setColor(0xBE5F1F) .setTitle(body.data.name) @@ -57,7 +57,7 @@ module.exports = class YuGiOhCommand extends Command { .addField('**Card Type:**', body.data.card_type, true); return msg.embed(embed); - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/textedit/binary.js b/commands/textedit/binary.js index a15b363b..b4ecd90a 100644 --- a/commands/textedit/binary.js +++ b/commands/textedit/binary.js @@ -20,7 +20,7 @@ module.exports = class BinaryCommand extends Command { prompt: 'What text would you like to convert to binary?', type: 'string', validate: text => { - if(binary(text).length < 2000) return true; + if (binary(text).length < 2000) return true; return 'Your text is too long.'; }, parse: text => binary(text) diff --git a/commands/textedit/cowsay.js b/commands/textedit/cowsay.js index 75439249..fee178cd 100644 --- a/commands/textedit/cowsay.js +++ b/commands/textedit/cowsay.js @@ -14,7 +14,7 @@ module.exports = class CowsayCommand extends Command { prompt: 'What text would you like the cow to say?', type: 'string', validate: text => { - if(text.length < 1500) return true; + if (text.length < 1500) return true; return 'Invalid Text. Text must be under 1500 characters.'; } } diff --git a/commands/textedit/embed.js b/commands/textedit/embed.js index b21bfa6f..c3bd0dee 100644 --- a/commands/textedit/embed.js +++ b/commands/textedit/embed.js @@ -19,8 +19,8 @@ module.exports = class EmbedCommand extends Command { } run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { text } = args; const embed = new RichEmbed() diff --git a/commands/textedit/morse.js b/commands/textedit/morse.js index b0e2b23f..06d68add 100644 --- a/commands/textedit/morse.js +++ b/commands/textedit/morse.js @@ -15,7 +15,7 @@ module.exports = class MorseCommand extends Command { prompt: 'What text would you like to convert to morse?', type: 'string', validate: text => { - if(letterTrans(text, dictionary, ' ').length < 1999) return true; + if (letterTrans(text, dictionary, ' ').length < 1999) return true; return 'Your text is too long.'; }, parse: text => letterTrans(text.toLowerCase(), dictionary, ' ') diff --git a/commands/textedit/pirate.js b/commands/textedit/pirate.js index f55e4412..4a83d388 100644 --- a/commands/textedit/pirate.js +++ b/commands/textedit/pirate.js @@ -15,7 +15,7 @@ module.exports = class PirateCommand extends Command { prompt: 'What text would you like to convert to pirate?', type: 'string', validate: text => { - if(wordTrans(text, dictionary).length < 1999) return true; + if (wordTrans(text, dictionary).length < 1999) return true; return 'Your text is too long.'; }, parse: text => wordTrans(text, dictionary) diff --git a/commands/textedit/say.js b/commands/textedit/say.js index 4764f56d..a16b3f34 100644 --- a/commands/textedit/say.js +++ b/commands/textedit/say.js @@ -4,10 +4,7 @@ module.exports = class SayCommand extends Command { constructor(client) { super(client, { name: 'say', - aliases: [ - 'copy', - 'echo' - ], + aliases: ['copy', 'echo'], group: 'textedit', memberName: 'say', description: 'Make XiaoBot say what you wish.', @@ -23,7 +20,7 @@ module.exports = class SayCommand extends Command { } run(msg, args) { - if(!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES')) + if (!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES')) return msg.say('This Command requires the `Manage Messages` Permission.'); const { text } = args; msg.delete(); diff --git a/commands/textedit/temmie.js b/commands/textedit/temmie.js index c5c51ea7..34b28c1c 100644 --- a/commands/textedit/temmie.js +++ b/commands/textedit/temmie.js @@ -15,7 +15,7 @@ module.exports = class TemmieCommand extends Command { prompt: 'What text would you like to convert to Temmie speak?', type: 'string', validate: text => { - if(wordTrans(text, dictionary).length < 1999) return true; + if (wordTrans(text, dictionary).length < 1999) return true; return 'Your text is too long.'; }, parse: text => wordTrans(text, dictionary) diff --git a/commands/textedit/upsidedown.js b/commands/textedit/upsidedown.js index f57eadf7..480ecaf4 100644 --- a/commands/textedit/upsidedown.js +++ b/commands/textedit/upsidedown.js @@ -6,9 +6,7 @@ module.exports = class UpsideDownCommand extends Command { constructor(client) { super(client, { name: 'upside-down', - aliases: [ - 'udown' - ], + aliases: ['udown'], group: 'textedit', memberName: 'upside-down', description: 'Flips text upside-down.', diff --git a/commands/textedit/webhook.js b/commands/textedit/webhook.js index 422c245a..8a7dff2f 100644 --- a/commands/textedit/webhook.js +++ b/commands/textedit/webhook.js @@ -5,10 +5,7 @@ module.exports = class WebhookCommand extends Command { constructor(client) { super(client, { name: 'webhook', - aliases: [ - 'rin', - 'rin-say' - ], + aliases: ['rin', 'rin-say'], group: 'textedit', memberName: 'webhook', description: 'Posts a message to the webhook defined in your `process.env`.', @@ -28,7 +25,7 @@ module.exports = class WebhookCommand extends Command { } async run(msg, args) { - if(!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES')) + if (!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES')) return msg.say('This Command requires the `Manage Messages` Permission.'); const { content } = args; try { @@ -37,7 +34,7 @@ module.exports = class WebhookCommand extends Command { .post(process.env.WEBHOOK_URL) .send({ content }); return null; - } catch(err) { + } catch (err) { return msg.say(`An Error Occurred: ${err}`); } } diff --git a/commands/textedit/zalgo.js b/commands/textedit/zalgo.js index 631d8347..e588518a 100644 --- a/commands/textedit/zalgo.js +++ b/commands/textedit/zalgo.js @@ -14,7 +14,7 @@ module.exports = class ZalgoCommand extends Command { prompt: 'What text would you like to convert to zalgo?', type: 'string', validate: text => { - if(text.length < 500) return true; + if (text.length < 500) return true; return 'Invalid Text. Text must be under 500 characters.'; }, parse: text => zalgo(text) diff --git a/commands/userinfo/userinfo.js b/commands/userinfo/userinfo.js index afb63802..e8f09963 100644 --- a/commands/userinfo/userinfo.js +++ b/commands/userinfo/userinfo.js @@ -8,11 +8,7 @@ module.exports = class UserInfoCommand extends Command { constructor(client) { super(client, { name: 'user', - aliases: [ - 'user-info', - 'member', - 'member-info' - ], + aliases: ['user-info', 'member', 'member-info'], group: 'userinfo', memberName: 'user', description: 'Gives some info on a user.', @@ -28,8 +24,8 @@ module.exports = class UserInfoCommand extends Command { } run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { user } = args; const member = msg.guild.member(user); diff --git a/commands/util/clearsetting.js b/commands/util/clearsetting.js index f2e59a64..5a2f1f21 100644 --- a/commands/util/clearsetting.js +++ b/commands/util/clearsetting.js @@ -14,7 +14,7 @@ module.exports = class ClearSettingCommand extends Command { prompt: 'What setting do you want to clear? `modLog`, `memberLog`, `joinMsg`, `leaveMsg`, `staffRole`, or `singleRole`?', type: 'string', validate: setting => { - if(['modLog', 'memberLog', 'joinMsg', 'leaveMsg', 'staffRole', 'singleRole'].includes(setting)) return true; + if (['modLog', 'memberLog', 'joinMsg', 'leaveMsg', 'staffRole', 'singleRole'].includes(setting)) return true; return 'Please enter either `modLog`, `memberLog`, `joinMsg`, `leaveMsg`, `staffRole`, or `singleRole`.'; } } diff --git a/commands/util/help.js b/commands/util/help.js index 54df5456..d304a7dc 100644 --- a/commands/util/help.js +++ b/commands/util/help.js @@ -6,9 +6,7 @@ module.exports = class HelpCommand extends Command { constructor(client) { super(client, { name: 'help', - aliases: [ - 'commands' - ], + aliases: ['commands'], group: 'util', memberName: 'help', description: 'Displays a list of available commands, or detailed information for a specified command.', @@ -28,8 +26,8 @@ module.exports = class HelpCommand extends Command { const { command } = args; const commands = this.client.registry.findCommands(command, false, msg); const showAll = command && command.toLowerCase() === 'all'; - if(command && !showAll) { - if(commands.length === 1) { + if (command && !showAll) { + if (commands.length === 1) { return msg.say(stripIndents` __Command **${commands[0].name}**:__ *${commands[0].description}* ${commands[0].guildOnly ? 'Usable Only in Servers' : 'Usable in Servers and DM'} @@ -38,7 +36,7 @@ module.exports = class HelpCommand extends Command { **Group:** ${commands[0].group.name} ${commands[0].details || ''} `); - } else if(commands.length > 1) { + } else if (commands.length > 1) { return msg.say(`Multiple Commands Found. Please be more specific: ${commands.map(c => `"${c.name}"`).join(', ')}`); } else { return msg.say(`Could not identify command. Use ${msg.usage(null)} to view a list of commands you can use.`); @@ -48,7 +46,7 @@ module.exports = class HelpCommand extends Command { .setTitle(!showAll ? `Commands Available in ${msg.guild ? msg.guild.name : 'this DM'}` : 'All Commands') .setDescription(`Use ${msg.usage('')} to view detailed information about a specific command.`) .setColor(0x00AE86); - for(const group of this.client.registry.groups.array()) { + for (const group of this.client.registry.groups.array()) { embed.addField(group.name, !showAll ? group.commands.filter(c => c.isUsable(msg)).map(c => `\`${c.name}\``).join(', ') || 'None Available' : @@ -57,7 +55,7 @@ module.exports = class HelpCommand extends Command { try { await msg.author.send({ embed }); return msg.say(':mailbox_with_mail: Sent you a DM with information.'); - } catch(err) { + } catch (err) { return msg.say('Failed to send DM. You probably have DMs disabled.'); } } diff --git a/commands/util/info.js b/commands/util/info.js index 06261e9b..1a7419eb 100644 --- a/commands/util/info.js +++ b/commands/util/info.js @@ -9,9 +9,7 @@ module.exports = class InfoCommand extends Command { constructor(client) { super(client, { name: 'info', - aliases: [ - 'information' - ], + aliases: ['information'], group: 'util', memberName: 'info', description: 'Gives some bot info for your shard.' @@ -19,8 +17,8 @@ module.exports = class InfoCommand extends Command { } async run(msg) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const guilds = await this.client.shard.fetchClientValues('guilds.size'); const memory = await this.client.shard.broadcastEval('Math.round(process.memoryUsage().heapUsed / 1024 / 1024)'); diff --git a/commands/util/membermsg.js b/commands/util/membermsg.js index 7d573d5c..39d23f1b 100644 --- a/commands/util/membermsg.js +++ b/commands/util/membermsg.js @@ -4,9 +4,7 @@ module.exports = class MemberMsgCommand extends Command { constructor(client) { super(client, { name: 'member-message', - aliases: [ - 'member-msg' - ], + aliases: ['member-msg'], group: 'util', memberName: 'member-message', description: 'Sets the message for either join/leave logs to use.', @@ -18,7 +16,7 @@ module.exports = class MemberMsgCommand extends Command { prompt: 'Which message would you like to change? Please enter either `joinMsg` or `leaveMsg`.', type: 'string', validate: type => { - if(['joinMsg', 'leaveMsg'].includes(type)) return true; + if (['joinMsg', 'leaveMsg'].includes(type)) return true; return 'Please enter either `joinMsg` or `leaveMsg`.'; } }, @@ -27,7 +25,7 @@ module.exports = class MemberMsgCommand extends Command { prompt: 'What should be sent to the channel? Use , , and as placeholders.', type: 'string', validate: message => { - if(message.length < 1000) return true; + if (message.length < 1000) return true; return 'Invalid Message. Message must be under 1000 characters.'; } } @@ -41,10 +39,10 @@ module.exports = class MemberMsgCommand extends Command { run(msg, args) { const { type, message } = args; - if(type === 'joinMsg') { + if (type === 'joinMsg') { msg.guild.settings.set('joinMsg', message); return msg.say(`Join Message set to "${message}".`); - } else if(type === 'leaveMsg') { + } else if (type === 'leaveMsg') { msg.guild.settings.set('leaveMsg', message); return msg.say(`Leave Message set to "${message}".`); } diff --git a/commands/util/shardinfo.js b/commands/util/shardinfo.js index 5def7bf3..90a008eb 100644 --- a/commands/util/shardinfo.js +++ b/commands/util/shardinfo.js @@ -7,9 +7,7 @@ module.exports = class ShardInfoCommand extends Command { constructor(client) { super(client, { name: 'shard-info', - aliases: [ - 'shard' - ], + aliases: ['shard'], group: 'util', memberName: 'shard-info', description: 'Gives some bot info for the Shard you specify.', @@ -19,7 +17,7 @@ module.exports = class ShardInfoCommand extends Command { prompt: 'Which Shard would you like to get data for?', type: 'integer', validate: shard => { - if(shard < this.client.options.shardCount && shard > -1) return true; + if (shard < this.client.options.shardCount && shard > -1) return true; return 'Invalid Shard ID'; } } @@ -28,8 +26,8 @@ module.exports = class ShardInfoCommand extends Command { } async run(msg, args) { - if(msg.channel.type !== 'dm') - if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { shard } = args; const memory = await this.client.shard.broadcastEval('Math.round(process.memoryUsage().heapUsed / 1024 / 1024)'); diff --git a/index.js b/index.js index 14b6d8da..d3ce5de5 100644 --- a/index.js +++ b/index.js @@ -36,19 +36,19 @@ client.registry .registerCommandsIn(path.join(__dirname, 'commands')); client.dispatcher.addInhibitor(msg => { - if(msg.channel.type === 'dm') return false; + if (msg.channel.type === 'dm') return false; const role = msg.guild.settings.get('singleRole'); - if(!role) return false; - if(client.isOwner(msg.author)) return false; - if(msg.member.hasPermission('ADMINISTRATOR')) return false; - if(!msg.member.roles.has(role)) + if (!role) return false; + if (client.isOwner(msg.author)) return false; + if (msg.member.hasPermission('ADMINISTRATOR')) return false; + if (!msg.member.roles.has(role)) return ['singleRole', msg.reply(`Only the ${msg.guild.roles.get(role).name} role may use commands.`)]; }); client.on('guildMemberAdd', (member) => { const channel = member.guild.channels.get(member.guild.settings.get('memberLog')); - if(!channel) return; - if(!channel.permissionsFor(client.user).has('SEND_MESSAGES')) return; + if (!channel) return; + if (!channel.permissionsFor(client.user).has('SEND_MESSAGES')) return; const msg = member.guild.settings.get('joinMsg', 'Welcome !') .replace(/()/gi, member.user.username) .replace(/()/gi, member.guild.name) @@ -58,8 +58,8 @@ client.on('guildMemberAdd', (member) => { client.on('guildMemberRemove', (member) => { const channel = member.guild.channels.get(member.guild.settings.get('memberLog')); - if(!channel) return; - if(!channel.permissionsFor(client.user).has('SEND_MESSAGES')) return; + if (!channel) return; + if (!channel.permissionsFor(client.user).has('SEND_MESSAGES')) return; const msg = member.guild.settings.get('leaveMsg', 'Bye ...') .replace(/()/gi, member.user.username) .replace(/()/gi, member.guild.name) @@ -67,7 +67,7 @@ client.on('guildMemberRemove', (member) => { return channel.send(msg); }); -client.on('guildCreate', async(guild) => { +client.on('guildCreate', async (guild) => { console.log(`[Guild] I have joined ${guild.name}! (${guild.id})`); const guilds = await client.shard.fetchClientValues('guilds.size'); const count = guilds.reduce((prev, val) => prev + val, 0); @@ -75,18 +75,18 @@ client.on('guildCreate', async(guild) => { try { await carbon(count); console.log('[Carbon] Successfully posted to Carbon.'); - } catch(err) { + } catch (err) { console.log(`[Carbon] Failed to post to Carbon. ${err}`); } try { await discordBots(count, client.user.id); console.log('[Discord Bots] Successfully posted to Discord Bots.'); - } catch(err) { + } catch (err) { console.log(`[Discord Bots] Failed to post to Discord Bots. ${err}`); } }); -client.on('guildDelete', async(guild) => { +client.on('guildDelete', async (guild) => { console.log(`[Guild] I have left ${guild.name}... (${guild.id})`); const guilds = await client.shard.fetchClientValues('guilds.size'); const count = guilds.reduce((prev, val) => prev + val, 0); @@ -94,13 +94,13 @@ client.on('guildDelete', async(guild) => { try { await carbon(count); console.log('[Carbon] Successfully posted to Carbon.'); - } catch(err) { + } catch (err) { console.log(`[Carbon] Failed to post to Carbon. ${err}`); } try { await discordBots(count, client.user.id); console.log('[Discord Bots] Successfully posted to Discord Bots.'); - } catch(err) { + } catch (err) { console.log(`[Discord Bots] Failed to post to Discord Bots. ${err}`); } }); diff --git a/package.json b/package.json index ce7d2c9a..b675a7a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "18.6.2", + "version": "18.6.3", "description": "A Discord Bot", "main": "shardingmanager.js", "scripts": { diff --git a/providers/Sequelize.js b/providers/Sequelize.js index 7423d25b..85cab50e 100644 --- a/providers/Sequelize.js +++ b/providers/Sequelize.js @@ -229,7 +229,7 @@ class SequelizeProvider extends SettingProvider { key = JSON.stringify(key); val = typeof val !== 'undefined' ? JSON.stringify(val) : 'undefined'; this.client.shard.broadcastEval(` - if(this.shard.id !== ${this.client.shard.id} && this.provider && this.provider.settings) { + if (this.shard.id !== ${this.client.shard.id} && this.provider && this.provider.settings) { this.provider.settings.global[${key}] = ${val}; } `); diff --git a/structures/PostgreSQL.js b/structures/PostgreSQL.js index 9d569319..8075cb00 100644 --- a/structures/PostgreSQL.js +++ b/structures/PostgreSQL.js @@ -12,10 +12,10 @@ class Database { .then(() => console.log('[Database] Synchronizing...')) .then(() => database.sync() .then(() => console.log('[Database] Synchronizing complete!')) - .catch(err => console.error(`[Database] Error synchronizing: ${err}`)) + .catch (err => console.error(`[Database] Error synchronizing: ${err}`)) ) .then(() => console.log('[Database] Ready!')) - .catch(err => console.error(`[Database] Unable to connect: ${err}`)); + .catch (err => console.error(`[Database] Unable to connect: ${err}`)); } }