diff --git a/assets/json/easter-egg.json b/assets/json/easter-egg.json index 73f68368..b5272431 100644 --- a/assets/json/easter-egg.json +++ b/assets/json/easter-egg.json @@ -5,7 +5,7 @@ "tag": "This command is *easter egg*, not *tag* :yum:", "easter egg": ":egg:", "snek": "*Blame :snake:*", - "snekfetch": "superagent is better.", + "snekfetch": "The best.", "xiaobot": "That's my name.", "dragonfire535": "http://dragonfire535.tk", "heroes of dreamland": "https://www.wattpad.com/story/8712240-heroes-of-dreamland-book-1-kirby-and-the-monstrous", @@ -32,7 +32,7 @@ "book1": "Book.", "new": "Nope, not quite yet.", "adam": "Adam pls.", - "token": "[READACTED]", + "token": "[REDACTED]", "nom": "https://cdn.discordapp.com/attachments/256055608279695360/308434352377954304/tumblr_ojzfs3jjoJ1qz64n4o1_540.gif", "good vs evil": "https://cdn.discordapp.com/attachments/256055608279695360/308404323392684033/837631b64ef351ddabe8c2200c2feca54d81af62_hq.jpg", "ebearskittychan": "The best :heart:", diff --git a/assets/json/magic-conch.json b/assets/json/magic-conch.json deleted file mode 100644 index 8e1ac304..00000000 --- a/assets/json/magic-conch.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "Maybe someday", - "Nothing", - "Neither", - "I don't think so", - "Yes", - "Try asking again" -] diff --git a/assets/json/math-game.json b/assets/json/math-game.json deleted file mode 100644 index 7feb2818..00000000 --- a/assets/json/math-game.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "operations": { - "easy": [ - "+", - "-" - ], - "medium": [ - "+", - "-" - ], - "hard": [ - "-", - "*" - ], - "extreme": [ - "*", - "/" - ], - "impossible": [ - "/", - "^" - ] - }, - "difficulties": [ - "easy", - "medium", - "hard", - "extreme", - "impossible" - ], - "maxValues": { - "easy": 5, - "medium": 10, - "hard": 50, - "extreme": 75, - "impossible": 100 - } -} diff --git a/assets/json/server-info.json b/assets/json/server-info.json deleted file mode 100644 index 090126fe..00000000 --- a/assets/json/server-info.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "filterLevels": [ - "Off", - "No Role", - "Everyone" - ], - "verificationLevels": [ - "None", - "Low", - "Medium", - "(╯°□°)╯︵ ┻━┻", - "┻━┻ ミヽ(ಠ益ಠ)ノ彡┻━┻" - ] -} diff --git a/assets/json/soundboard.json b/assets/json/soundboard.json deleted file mode 100644 index 0739be65..00000000 --- a/assets/json/soundboard.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - "airhorn", - "cat", - "dun-dun-dun", - "pikachu", - "space" -] diff --git a/assets/json/typing-game.json b/assets/json/typing-game.json index 98acfcff..18881889 100644 --- a/assets/json/typing-game.json +++ b/assets/json/typing-game.json @@ -1,48 +1,32 @@ -{ - "sentences": [ - "The quick brown fox jumps over the lazy dog.", - "Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.", - "How razorback-jumping frogs can level six piqued gymnasts!", - "Amazingly few discotheques provide jukeboxes.", - "I am so blue I'm greener than purple.", - "I stepped on a Corn Flake, now I'm a Cereal Killer.", - "On a scale from one to ten what is your favourite colour of the alphabet?", - "The sparkly lamp ate a pillow then punched Larry.", - "My world is where everybody is a pony and we all eat rainbows and poop butterflies.", - "If your canoe is stuck in a tree with the headlights on, how many pancakes does it take to get to the moon?", - "There's a purple mushroom in my backyard, screaming Taco's!", - "When life gives you lemons, chuck them at people you hate.", - "I think I will buy the red car, or I will lease the blue one.", - "Italy is my favorite country; in fact, I plan to spend two weeks there next year.", - "She borrowed the book from him many years ago and hasn't yet returned it.", - "Lets all be unique together until we realise we are all the same.", - "If Purple People Eaters are real… where do they find purple people to eat?", - "The waves were crashing on the shore; it was a lovely sight.", - "This is the last random sentence I will be writing and I am going to stop mid-sent.", - "The memory we used to share is no longer coherent.", - "She did not cheat on the test, for it was not the right thing to do.", - "She only paints with bold colors; she does not like pastels.", - "Malls are great places to shop; I can find everything I need under one roof.", - "The body may perhaps compensates for the loss of a true metaphysics.", - "They got there early, and they got really good seats.", - "Everyone was busy, so I went to the movie alone.", - "Yeah, I think it's a good environment for learning English.", - "I would have gotten the promotion, but my attendance wasn’t good enough.", - "There were white out conditions in the town; subsequently, the roads were impassable.", - "If you like tuna and tomato sauce- try combining the two. It’s really not as bad as it sounds." - ], - "difficulties": [ - "easy", - "medium", - "hard", - "extreme", - "impossible" - ], - "times": { - "easy": 25000, - "medium": 20000, - "hard": 15000, - "extreme": 10000, - "impossible": 5000 - } -} +[ + "The quick brown fox jumps over the lazy dog.", + "Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.", + "How razorback-jumping frogs can level six piqued gymnasts!", + "Amazingly few discotheques provide jukeboxes.", + "I am so blue I'm greener than purple.", + "I stepped on a Corn Flake, now I'm a Cereal Killer.", + "On a scale from one to ten what is your favourite colour of the alphabet?", + "The sparkly lamp ate a pillow then punched Larry.", + "My world is where everybody is a pony and we all eat rainbows and poop butterflies.", + "If your canoe is stuck in a tree with the headlights on, how many pancakes does it take to get to the moon?", + "There's a purple mushroom in my backyard, screaming Taco's!", + "When life gives you lemons, chuck them at people you hate.", + "I think I will buy the red car, or I will lease the blue one.", + "Italy is my favorite country; in fact, I plan to spend two weeks there next year.", + "She borrowed the book from him many years ago and hasn't yet returned it.", + "Lets all be unique together until we realise we are all the same.", + "If Purple People Eaters are real… where do they find purple people to eat?", + "The waves were crashing on the shore; it was a lovely sight.", + "This is the last random sentence I will be writing and I am going to stop mid-sent.", + "The memory we used to share is no longer coherent.", + "She did not cheat on the test, for it was not the right thing to do.", + "She only paints with bold colors; she does not like pastels.", + "Malls are great places to shop; I can find everything I need under one roof.", + "The body may perhaps compensates for the loss of a true metaphysics.", + "They got there early, and they got really good seats.", + "Everyone was busy, so I went to the movie alone.", + "Yeah, I think it's a good environment for learning English.", + "I would have gotten the promotion, but my attendance wasn’t good enough.", + "There were white out conditions in the town; subsequently, the roads were impassable.", + "If you like tuna and tomato sauce- try combining the two. It’s really not as bad as it sounds." +] diff --git a/assets/json/user-info.json b/assets/json/user-info.json deleted file mode 100644 index cf10c9fd..00000000 --- a/assets/json/user-info.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "online": "<:online:313956277808005120> Online", - "idle": "<:away:313956277220802560> Idle", - "dnd": "<:dnd:313956276893646850> Do Not Disturb", - "offline": "<:offline:313956277237710868> Offline" -} diff --git a/commands/games/battle.js b/commands/games/battle.js index 3558aea6..1d5bf663 100644 --- a/commands/games/battle.js +++ b/commands/games/battle.js @@ -9,11 +9,10 @@ module.exports = class BattleCommand extends Command { group: 'games', memberName: 'battle', description: 'Engage in a turn-based battle against another user or the AI.', - guildOnly: true, args: [ { key: 'opponent', - prompt: 'Who would you like to battle?', + prompt: 'What user would you like to battle?', type: 'user', default: '' } @@ -26,17 +25,17 @@ module.exports = class BattleCommand extends Command { async run(msg, args) { // eslint-disable-line complexity const opponent = args.opponent || this.client.user; if (opponent.id === msg.author.id) return msg.say('You may not fight yourself.'); - if (this.fighting.has(msg.guild.id)) return msg.say('Only one fight may be occurring per server.'); - this.fighting.add(msg.guild.id); + if (this.fighting.has(msg.channel.id)) return msg.say('Only one fight may be occurring per channel.'); + this.fighting.add(msg.channel.id); try { if (!opponent.bot) { - await msg.say(`${opponent}, do you accept this challenge? **__Y__es** or **No**?`); + await msg.say(`${opponent}, do you accept this challenge?`); const verify = await msg.channel.awaitMessages(res => res.author.id === opponent.id, { max: 1, time: 30000 }); if (!verify.size || !['yes', 'y'].includes(verify.first().content.toLowerCase())) { - this.fighting.delete(msg.guild.id); + this.fighting.delete(msg.channel.id); return msg.say('Looks like they declined...'); } } @@ -65,7 +64,7 @@ module.exports = class BattleCommand extends Command { await msg.say(stripIndents` ${user}, do you **fight**, **guard**, **special**, or **run**? **${msg.author.username}**: ${userHP}HP - **${opponent === 'AI' ? 'AI' : opponent.username}**: ${oppoHP}HP + **${opponent.username}**: ${oppoHP}HP `); const turn = await msg.channel.awaitMessages(res => res.author.id === id, { max: 1, @@ -109,15 +108,15 @@ module.exports = class BattleCommand extends Command { await msg.say(`${user}, I do not understand what you want to do.`); } } - this.fighting.delete(msg.guild.id); + this.fighting.delete(msg.channel.id); return msg.say(stripIndents` The match is over! **Winner:** ${userHP > oppoHP ? `${msg.author} (${userHP}HP)` : `${opponent} (${oppoHP}HP)`} **Loser:** ${userHP > oppoHP ? `${opponent} (${oppoHP}HP)` : `${msg.author} (${userHP}HP)`} `); } catch (err) { - this.fighting.delete(msg.guild.id); - return msg.say(`Oh no, an Error occurred: \`${err.message}\`. Try again later!`); + this.fighting.delete(msg.channel.id); + return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); } } }; diff --git a/commands/games/fishy.js b/commands/games/fishy.js index 8fc532f6..e662e126 100644 --- a/commands/games/fishy.js +++ b/commands/games/fishy.js @@ -5,6 +5,7 @@ module.exports = class FishyCommand extends Command { constructor(client) { super(client, { name: 'fishy', + aliases: ['fish'], group: 'games', memberName: 'fishy', description: 'Catches a fish.' diff --git a/commands/games/gunfight.js b/commands/games/gunfight.js index 44819e6b..1d607b4d 100644 --- a/commands/games/gunfight.js +++ b/commands/games/gunfight.js @@ -27,16 +27,16 @@ module.exports = class GunfightCommand extends Command { const { opponent } = args; if (opponent.bot) return msg.say('Bots may not be fought.'); if (opponent.id === msg.author.id) return msg.say('You may not fight yourself.'); - if (this.fighting.has(msg.guild.id)) return msg.say('Only one fight may be occurring per server.'); - this.fighting.add(msg.guild.id); + if (this.fighting.has(msg.channel.id)) return msg.say('Only one fight may be occurring per channel.'); + this.fighting.add(msg.channel.id); try { - await msg.say(`${opponent}, do you accept this challenge? **__Y__es** or **No**?`); + await msg.say(`${opponent}, do you accept this challenge?`); const verify = await msg.channel.awaitMessages(res => res.author.id === opponent.id, { max: 1, time: 30000 }); if (!verify.size || !['yes', 'y'].includes(verify.first().content.toLowerCase())) { - this.fighting.delete(msg.guild.id); + this.fighting.delete(msg.channel.id); return msg.say('Looks like they declined...'); } await msg.say('Get Ready...'); @@ -49,12 +49,12 @@ module.exports = class GunfightCommand extends Command { max: 1, time: 30000 }); - this.fighting.delete(msg.guild.id); + this.fighting.delete(msg.channel.id); if (!winner.size) return msg.say('Oh... No one won.'); return msg.say(`And the winner is ${winner.first().author.username}!`); } catch (err) { - this.fighting.delete(msg.guild.id); - return msg.say(`Oh no, an Error occurred: \`${err.message}\`. Try again later!`); + this.fighting.delete(msg.channel.id); + return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); } } }; diff --git a/commands/games/hangman.js b/commands/games/hangman.js index e0c51b1f..9e7d1ae1 100644 --- a/commands/games/hangman.js +++ b/commands/games/hangman.js @@ -17,8 +17,8 @@ module.exports = class HangmanCommand extends Command { } async run(msg) { - if (this.playing.has(msg.guild.id)) return msg.say('Only one game may be occurring per server.'); - this.playing.add(msg.guild.id); + if (this.playing.has(msg.channel.id)) return msg.say('Only one game may be occurring per channel.'); + this.playing.add(msg.channel.id); try { const { body } = await snekfetch .get('http://api.wordnik.com:80/v4/words.json/randomWord') @@ -32,7 +32,7 @@ module.exports = class HangmanCommand extends Command { maxLength: -1, api_key: WORDNIK_KEY }); - const word = body.word.toLowerCase().replace(/[ ]/g, '-'); + const word = body.word.toLowerCase().replace(/ /g, '-'); let points = 0; const confirmation = []; const incorrect = []; @@ -61,10 +61,9 @@ module.exports = class HangmanCommand extends Command { } else if (word.includes(choice)) { await msg.say('Nice job!'); for (let i = 0; i < word.length; i++) { - if (word[i] === choice) { // eslint-disable-line max-depth - confirmation.push(word[i]); - display[i] = word[i]; - } + if (word[i] !== choice) continue; // eslint-disable-line max-depth + confirmation.push(word[i]); + display[i] = word[i]; } } else { await msg.say('Nope!'); @@ -72,12 +71,12 @@ module.exports = class HangmanCommand extends Command { points++; } } - this.playing.delete(msg.guild.id); + this.playing.delete(msg.channel.id); if (word.length === confirmation.length) return msg.say(`You won, it was ${word}!`); return msg.say(`Too bad... It was ${word}...`); } catch (err) { - this.playing.delete(msg.guild.id); - return msg.say(`Oh no, an Error occurred: \`${err.message}\`. Try again later!`); + this.playing.delete(msg.channel.id); + return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); } } }; diff --git a/commands/games/lottery.js b/commands/games/lottery.js index 9d5e3824..39ebf761 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 === 1) return msg.reply(`Wow! You actually won! Great job!`); - return msg.reply(`Nope, sorry, you lost.`); + if (lottery === 1) return msg.reply('Nice job! 10/10! You deserve some cake!'); + return msg.reply('Nope, sorry, you lost.'); } }; diff --git a/commands/games/math-game.js b/commands/games/math-game.js index 45e82ac0..6dd2dac6 100644 --- a/commands/games/math-game.js +++ b/commands/games/math-game.js @@ -1,7 +1,22 @@ const Command = require('../../structures/Command'); const { MessageEmbed } = require('discord.js'); const math = require('mathjs'); -const { operations, difficulties, maxValues } = require('../../assets/json/math-game'); +const { list } = require('../../structures/Util'); +const difficulties = ['easy', 'medium', 'hard', 'extreme', 'impossible']; +const operations = { + easy: ['+', '-'], + medium: ['+', '-'], + hard: ['-', '*'], + extreme: ['*', '/'], + impossible: ['/', '^'] +}; +const maxValues = { + easy: 5, + medium: 10, + hard: 50, + extreme: 75, + impossible: 100 +}; module.exports = class MathGameCommand extends Command { constructor(client) { @@ -14,11 +29,11 @@ module.exports = class MathGameCommand extends Command { args: [ { key: 'difficulty', - prompt: `What should the difficulty of the game be? One of: ${difficulties.join(', ')}`, + prompt: `What should the difficulty of the game be? Either ${list(difficulties, 'or')}.`, type: 'string', validate: difficulty => { if (difficulties.includes(difficulty.toLowerCase())) return true; - return `The difficulty must be one of: ${difficulties.join(', ')}`; + return `Invalid difficulty, please enter either ${list(difficulties, 'or')}.`; }, parse: difficulty => difficulty.toLowerCase() } diff --git a/commands/games/quiz.js b/commands/games/quiz.js index 4dde10d6..1408858d 100644 --- a/commands/games/quiz.js +++ b/commands/games/quiz.js @@ -3,6 +3,7 @@ const { MessageEmbed } = require('discord.js'); const { stripIndents } = require('common-tags'); const snekfetch = require('snekfetch'); const { shuffle, list } = require('../../structures/Util'); +const types = ['multiple', 'boolean']; const difficulties = ['easy', 'medium', 'hard']; module.exports = class QuizCommand extends Command { @@ -17,22 +18,22 @@ module.exports = class QuizCommand extends Command { args: [ { key: 'type', - prompt: 'Which type of question would you like to have? `multiple` or `boolean`.', + prompt: `Which type of question would you like to have? Either ${list(types, 'or')}.`, type: 'string', validate: type => { - if (['multiple', 'boolean'].includes(type.toLowerCase())) return true; - return 'Please enter either `multiple` or `boolean`.'; + if (types.includes(type.toLowerCase())) return true; + return `Invalid type, please enter either ${list(types, 'or')}.`; }, parse: type => type.toLowerCase() }, { key: 'difficulty', - prompt: `What should the difficulty of the game be? One of: ${difficulties.join(', ')}`, + prompt: `What should the difficulty of the game be? Either ${list(difficulties, 'or')}.`, type: 'string', default: '', validate: difficulty => { if (difficulties.includes(difficulty.toLowerCase())) return true; - return `The difficulty must be one of: ${difficulties.join(', ')}`; + return `Invalid difficulty, please enter either ${list(difficulties, 'or')}.`; }, parse: difficulty => difficulty.toLowerCase() } diff --git a/commands/games/rock-paper-scissors.js b/commands/games/rock-paper-scissors.js index 34399e9f..1f07d7cf 100644 --- a/commands/games/rock-paper-scissors.js +++ b/commands/games/rock-paper-scissors.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const choices = ['paper', 'rock', 'scissors']; +const choices = ['rock', 'paper', 'scissors']; module.exports = class RockPaperScissorsCommand extends Command { constructor(client) { @@ -20,23 +20,24 @@ module.exports = class RockPaperScissorsCommand extends Command { }); } - run(msg, args) { // eslint-disable-line consistent-return + run(msg, args) { const { choice } = args; const response = choices[Math.floor(Math.random() * choices.length)]; if (choice === 'rock') { if (response === 'rock') return msg.say('Rock! Aw... A tie...'); - else if (response === 'paper') return msg.say('Paper! Yes! I win!'); - else if (response === 'scissors') return msg.say('Scissors! Aw... I lose...'); - } else if (choice === 'paper') { - if (response === 'rock') return msg.say('Rock! Aw... I lose...'); - else if (response === 'paper') return msg.say('Paper! Aw... A tie...'); - else if (response === 'scissors') return msg.say('Scissors! Yes! I win!'); - } else if (choice === 'scissors') { - if (response === 'rock') return msg.say('Rock! Yes! I win!'); - else if (response === 'paper') return msg.say('Paper! Aw... I lose...'); - else if (response === 'scissors') return msg.say('Scissors! Aw... A tie...'); - } else { - return msg.say('I win by default, you little cheater.'); + if (response === 'paper') return msg.say('Paper! Yes! I win!'); + if (response === 'scissors') return msg.say('Scissors! Aw... I lose...'); } + if (choice === 'paper') { + if (response === 'rock') return msg.say('Rock! Aw... I lose...'); + if (response === 'paper') return msg.say('Paper! Aw... A tie...'); + if (response === 'scissors') return msg.say('Scissors! Yes! I win!'); + } + 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... A tie...'); + } + return msg.say('I win by default, you little cheater.'); } }; diff --git a/commands/games/slots.js b/commands/games/slots.js index db24a97d..35c96726 100644 --- a/commands/games/slots.js +++ b/commands/games/slots.js @@ -21,11 +21,10 @@ module.exports = class SlotsCommand extends Command { ${slotOne}|${slotTwo}|${slotThree} Wow! You won! Great job... er... luck! `); - } else { - return msg.say(stripIndents` - ${slotOne}|${slotTwo}|${slotThree} - Aww... You lost... Guess it's just bad luck, huh? - `); } + return msg.say(stripIndents` + ${slotOne}|${slotTwo}|${slotThree} + Aww... You lost... Guess it's just bad luck, huh? + `); } }; diff --git a/commands/games/typing-game.js b/commands/games/typing-game.js index 2f1f14cb..9c34174c 100644 --- a/commands/games/typing-game.js +++ b/commands/games/typing-game.js @@ -1,6 +1,15 @@ const Command = require('../../structures/Command'); const { MessageEmbed } = require('discord.js'); -const { sentences, difficulties, times } = require('../../assets/json/typing-game'); +const { list } = require('../../structures/Util'); +const difficulties = ['easy', 'medium', 'hard', 'extreme', 'impossible']; +const times = { + easy: 25000, + medium: 20000, + hard: 15000, + extreme: 10000, + impossible: 5000 +}; +const sentences = require('../../assets/json/typing-game'); module.exports = class TypingGameCommand extends Command { constructor(client) { @@ -13,11 +22,11 @@ module.exports = class TypingGameCommand extends Command { args: [ { key: 'difficulty', - prompt: `What should the difficulty of the game be? One of: ${difficulties.join(', ')}`, + prompt: `What should the difficulty of the game be? Either ${list(difficulties, 'or')}.`, type: 'string', validate: difficulty => { if (difficulties.includes(difficulty.toLowerCase())) return true; - return `The difficulty must be one of: ${difficulties.join(', ')}`; + return `Invalid difficulty, please enter either ${list(difficulties, 'or')}.`; }, parse: difficulty => difficulty.toLowerCase() } diff --git a/commands/guild-info/channel-info.js b/commands/guild-info/channel-info.js new file mode 100644 index 00000000..ac3c651e --- /dev/null +++ b/commands/guild-info/channel-info.js @@ -0,0 +1,42 @@ +const Command = require('../../structures/Command'); +const { MessageEmbed } = require('discord.js'); +const moment = require('moment'); + +module.exports = class ChannelInfoCommand extends Command { + constructor(client) { + super(client, { + name: 'channel-info', + aliases: ['channel'], + group: 'guild-info', + memberName: 'channel-info', + description: 'Responds with detailed information on a channel.', + guildOnly: true, + clientPermissions: ['EMBED_LINKS'], + args: [ + { + key: 'channel', + prompt: 'Which channel would you like to get information on?', + type: 'channel', + default: '' + } + ] + }); + } + + run(msg, args) { + const channel = args.channel || msg.channel; + const embed = new MessageEmbed() + .setColor(0x00AE86) + .addField('❯ Name', + channel.name, true) + .addField('❯ ID', + channel.id, true) + .addField('❯ NSFW', + channel.nsfw ? 'Yes' : 'No', true) + .addField('❯ Creation Date', + moment(channel.createdAt).format('MMMM Do YYYY'), true) + .addField('❯ Topic', + channel.topic || 'None'); + return msg.embed(embed); + } +}; diff --git a/commands/guild-info/role-info.js b/commands/guild-info/role-info.js index 51c39cd0..b946c1ee 100644 --- a/commands/guild-info/role-info.js +++ b/commands/guild-info/role-info.js @@ -16,7 +16,7 @@ module.exports = class RoleInfoCommand extends Command { args: [ { key: 'role', - prompt: 'Which role would you like to get info on?', + prompt: 'Which role would you like to get information on?', type: 'role' } ] diff --git a/commands/guild-info/server-info.js b/commands/guild-info/server-info.js index fe0e1d02..9699eb2d 100644 --- a/commands/guild-info/server-info.js +++ b/commands/guild-info/server-info.js @@ -1,7 +1,8 @@ const Command = require('../../structures/Command'); const { MessageEmbed } = require('discord.js'); const moment = require('moment'); -const { filterLevels, verificationLevels } = require('../../assets/json/server-info'); +const filterLevels = ['Off', 'No Role', 'Everyone']; +const verificationLevels = ['None', 'Low', 'Medium', '(╯°□°)╯︵ ┻━┻', '┻━┻ ミヽ(ಠ益ಠ)ノ彡┻━┻']; module.exports = class GuildInfoCommand extends Command { constructor(client) { diff --git a/commands/image-edit/achievement.js b/commands/image-edit/achievement.js index 19a22d14..a07a45ae 100644 --- a/commands/image-edit/achievement.js +++ b/commands/image-edit/achievement.js @@ -16,7 +16,7 @@ module.exports = class AchievementCommand extends Command { type: 'string', validate: text => { if (text.length < 25) return true; - return 'Text must be under 25 characters.'; + return 'Please keep the text under 25 characters.'; } } ] diff --git a/commands/image-edit/meme.js b/commands/image-edit/meme.js index daa9355e..0908755e 100644 --- a/commands/image-edit/meme.js +++ b/commands/image-edit/meme.js @@ -1,4 +1,5 @@ const Command = require('../../structures/Command'); +const { list } = require('../../structures/Util'); const codes = require('../../assets/json/meme'); module.exports = class MemeCommand extends Command { @@ -7,17 +8,17 @@ module.exports = class MemeCommand extends Command { name: 'meme', group: 'image-edit', memberName: 'meme', - description: 'Sends a meme with text of your choice, and a background of your choice.', + description: 'Sends a meme with the text and background of your choice.', clientPermissions: ['ATTACH_FILES'], details: `**Codes:** ${codes.join(', ')}`, args: [ { key: 'type', - prompt: 'What meme type do you want to use?', + prompt: `What meme type do you want to use? Either ${list(codes, 'or')}.`, type: 'string', validate: type => { if (codes.includes(type.toLowerCase())) return true; - return 'Invalid meme type. Use `help meme` to view a list of meme types.'; + return `Invalid meme type, please enter either ${list(codes, 'or')}.`; }, parse: type => type.toLowerCase() }, @@ -29,7 +30,7 @@ module.exports = class MemeCommand extends Command { if (top.length < 200) return true; return 'Please keep the top text under 200 characters.'; }, - parse: top => encodeURIComponent(top.replace(/[ ]/g, '-')) + parse: top => encodeURIComponent(top.replace(/ /g, '-')) }, { key: 'bottom', @@ -39,7 +40,7 @@ module.exports = class MemeCommand extends Command { if (bottom.length < 200) return true; return 'Please keep the bottom text under 200 characters.'; }, - parse: bottom => encodeURIComponent(bottom.replace(/[ ]/g, '-')) + parse: bottom => encodeURIComponent(bottom.replace(/ /g, '-')) } ] }); diff --git a/commands/image-edit/pokemon-fusion.js b/commands/image-edit/pokemon-fusion.js index 2d65651e..029b7412 100644 --- a/commands/image-edit/pokemon-fusion.js +++ b/commands/image-edit/pokemon-fusion.js @@ -5,37 +5,37 @@ module.exports = class PokemonFusionCommand extends Command { constructor(client) { super(client, { name: 'pokemon-fusion', - aliases: ['poke-fusion', 'poke-fuse'], + aliases: ['poke-fusion', 'poke-fuse', 'pokémon-fusion', 'poké-fusion', 'poké-fuse'], group: 'image-edit', memberName: 'pokemon-fusion', description: 'Fuses two Generation I Pokémon together.', args: [ { - key: 'source1', + key: 'body', prompt: 'What Pokémon should be fused?', type: 'string', - validate: source1 => { - if (pokemon[source1.toLowerCase()]) return true; - return 'Only Pokémon from Generation I may be used.'; + validate: body => { + if (pokemon[body.toLowerCase()]) return true; + return 'Invalid body, only Pokémon from Generation I may be used.'; }, - parse: source1 => pokemon[source1.toLowerCase()] + parse: body => pokemon[body.toLowerCase()] }, { - key: 'source2', + key: 'palette', prompt: 'What Pokémon should be fused?', type: 'string', - validate: source2 => { - if (pokemon[source2.toLowerCase()]) return true; - return 'Only Pokémon from Generation I may be used.'; + validate: palette => { + if (pokemon[palette.toLowerCase()]) return true; + return 'Invalid palette, only Pokémon from Generation I may be used.'; }, - parse: source2 => pokemon[source2.toLowerCase()] + parse: palette => pokemon[palette.toLowerCase()] } ] }); } run(msg, args) { - const { source1, source2 } = args; - return msg.say(`http://images.alexonsager.net/pokemon/fused/${source1}/${source1}.${source2}.png`); + const { body, palette } = args; + return msg.say(`http://images.alexonsager.net/pokemon/fused/${body}/${palette}.${body}.png`); } }; diff --git a/commands/moderation/ban.js b/commands/moderation/ban.js index 2d1ab7df..0b4c0b84 100644 --- a/commands/moderation/ban.js +++ b/commands/moderation/ban.js @@ -26,7 +26,7 @@ module.exports = class BanCommand extends Command { type: 'string', validate: reason => { if (reason.length < 140) return true; - return 'Reason must be under 140 characters.'; + return 'Please keep the reason under 140 characters.'; } } ] diff --git a/commands/moderation/hackban.js b/commands/moderation/hackban.js index b2e78e90..cc0c0e97 100644 --- a/commands/moderation/hackban.js +++ b/commands/moderation/hackban.js @@ -26,7 +26,7 @@ module.exports = class HackbanCommand extends Command { type: 'string', validate: reason => { if (reason.length < 140) return true; - return 'Reason must be under 140 characters.'; + return 'Please keep the reason under 140 characters.'; } } ] @@ -40,7 +40,7 @@ module.exports = class HackbanCommand extends Command { if (id === msg.guild.ownerID) return msg.say('Don\'t you think that might be betraying your leader?'); let user; try { - user = await this.client.fetchUser(id); + user = await this.client.users.fetch(id); } catch (err) { return msg.say('Could not resolve user.'); } diff --git a/commands/moderation/kick.js b/commands/moderation/kick.js index f3ec360f..819150cb 100644 --- a/commands/moderation/kick.js +++ b/commands/moderation/kick.js @@ -26,7 +26,7 @@ module.exports = class KickCommand extends Command { type: 'string', validate: reason => { if (reason.length < 140) return true; - return 'Reason must be under 140 characters.'; + return 'Please keep the reason under 140 characters.'; } } ] diff --git a/commands/moderation/lockdown.js b/commands/moderation/lockdown.js index 025c6243..5782901f 100644 --- a/commands/moderation/lockdown.js +++ b/commands/moderation/lockdown.js @@ -1,5 +1,6 @@ const Command = require('../../structures/Command'); const { stripIndents } = require('common-tags'); +const { wait } = require('../../structures/Util'); module.exports = class LockdownCommand extends Command { constructor(client) { @@ -13,31 +14,47 @@ module.exports = class LockdownCommand extends Command { userPermissions: ['ADMINISTRATOR'], args: [ { - key: 'type', - prompt: 'Please enter either start or stop.', + key: 'action', + prompt: 'What action should be performed? Either start or stop.', type: 'string', default: 'start', - validate: type => { - if (['start', 'stop'].includes(type.toLowerCase())) return true; - return 'Please enter either start or stop.'; + validate: action => { + if (['start', 'stop'].includes(action.toLowerCase())) return true; + return 'Invalid action, please enter either start or stop.'; }, - parse: type => type.toLowerCase() + parse: action => action.toLowerCase() + }, + { + key: 'time', + prompt: 'How long should the channel be locked down (in minutes)?', + type: 'integer', + default: '', + validate: time => { + if (time > 0 && time < 11) return true; + return 'Please keep the time under 10 minutes.'; + }, + parse: time => time * 60000 } ] }); } async run(msg, args) { // eslint-disable-line consistent-return - const { type } = args; - if (type === 'start') { + const { action, time } = args; + if (action === 'start') { 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. + await msg.say(stripIndents` + Lockdown started, users without overwrites can no longer post messages. + ${time ? 'Please use `lockdown stop` to end the lockdown.' : `Please wait ${time / 60000} minutes.`} `); - } else if (type === 'stop') { + if (!time) return null; + await wait(time); await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: null }); - return msg.say('Lockdown Ended.'); + return msg.say('Lockdown ended, all users can now post messages.'); + } + if (action === 'stop') { + await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: null }); + return msg.say('Lockdown ended, all users can now post messages.'); } } }; diff --git a/commands/moderation/prune.js b/commands/moderation/prune.js index 2b26d994..87957c06 100644 --- a/commands/moderation/prune.js +++ b/commands/moderation/prune.js @@ -32,7 +32,7 @@ module.exports = class PruneCommand extends Command { async run(msg, args) { const { count } = args; try { - const messages = await msg.channel.fetchMessages({ limit: count + 1 }); + const messages = await msg.channel.messages.fetch({ limit: count + 1 }); await msg.channel.bulkDelete(messages, true); return null; } catch (err) { diff --git a/commands/moderation/softban.js b/commands/moderation/softban.js index 47f73920..4b20b0f5 100644 --- a/commands/moderation/softban.js +++ b/commands/moderation/softban.js @@ -26,7 +26,7 @@ module.exports = class SoftbanCommand extends Command { type: 'string', validate: reason => { if (reason.length < 140) return true; - return 'Reason must be under 140 characters.'; + return 'Please keep the reason under 140 characters.'; } } ] diff --git a/commands/moderation/unban.js b/commands/moderation/unban.js index de39ec25..9b3e35b8 100644 --- a/commands/moderation/unban.js +++ b/commands/moderation/unban.js @@ -26,7 +26,7 @@ module.exports = class UnbanCommand extends Command { type: 'string', validate: reason => { if (reason.length < 140) return true; - return 'Reason must be under 140 characters.'; + return 'Please keep the reason under 140 characters.'; } } ] diff --git a/commands/moderation/warn.js b/commands/moderation/warn.js index 5a5f4894..b0792e15 100644 --- a/commands/moderation/warn.js +++ b/commands/moderation/warn.js @@ -25,7 +25,7 @@ module.exports = class WarnCommand extends Command { type: 'string', validate: reason => { if (reason.length < 140) return true; - return 'Invalid Reason. Reason must be under 140 characters.'; + return 'Please keep the reason under 140 characters.'; } } ] diff --git a/commands/num-edit/currency.js b/commands/num-edit/currency.js index 18607170..eeb70e19 100644 --- a/commands/num-edit/currency.js +++ b/commands/num-edit/currency.js @@ -1,5 +1,6 @@ const Command = require('../../structures/Command'); const snekfetch = require('snekfetch'); +const { list } = require('../../structures/Util'); const codes = require('../../assets/json/currency'); module.exports = class CurrencyCommand extends Command { @@ -17,19 +18,19 @@ module.exports = class CurrencyCommand extends Command { type: 'string', validate: base => { if (codes.includes(base.toUpperCase())) return true; - return 'Invalid Currency Code. Use `help currency` to view a list of currency codes.'; + return `Invalid base, please enter either ${list(codes, 'or')}.`; }, parse: base => base.toUpperCase() }, { - key: 'to', + key: 'target', prompt: 'What currency code do you want to convert to?', type: 'string', - validate: to => { - if (codes.includes(to.toUpperCase())) return true; - return 'Invalid Currency Code. Use `help currency` to view a list of currency codes.'; + validate: target => { + if (codes.includes(target.toUpperCase())) return true; + return `Invalid target, please enter either ${list(codes, 'or')}.`; }, - parse: to => to.toUpperCase() + parse: target => target.toUpperCase() }, { key: 'amount', @@ -41,14 +42,14 @@ 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.`); + const { base, target, amount } = args; + if (base === target) return msg.say(`Converting ${base} to ${target} is the same value, dummy.`); const { body } = await snekfetch .get('http://api.fixer.io/latest') .query({ base, - symbols: to + symbols: target }); - return msg.say(`${amount} ${base} is ${amount * body.rates[to]} ${to}.`); + return msg.say(`${amount} ${base} is ${amount * body.rates[target]} ${target}.`); } }; diff --git a/commands/num-edit/temperature.js b/commands/num-edit/temperature.js index 36aa24f8..da1876e6 100644 --- a/commands/num-edit/temperature.js +++ b/commands/num-edit/temperature.js @@ -1,4 +1,6 @@ const Command = require('../../structures/Command'); +const { list } = require('../../structures/Util'); +const units = ['celsius', 'fahrenheit', 'kelvin']; module.exports = class TemperatureCommand extends Command { constructor(client) { @@ -6,27 +8,27 @@ module.exports = class TemperatureCommand extends Command { name: 'temperature', group: 'num-edit', memberName: 'temperature', - description: 'Converts temperatures to/from Celsius, Fahrenheit, or Kelvin.', + description: `Converts temperatures to/from ${list(units, 'or')}.`, args: [ { key: 'base', 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; - return 'Please enter either celsius, fahrenheit, or kelvin.'; + if (units.includes(base.toLowerCase())) return true; + return `Invalid base, please enter either ${list(units, 'or')}.`; }, parse: base => base.toLowerCase() }, { - key: 'to', + key: 'target', prompt: 'What temperature unit do you want to convert to?', type: 'string', - validate: to => { - if (['celsius', 'fahrenheit', 'kelvin'].includes(to.toLowerCase())) return true; - return 'Please enter either celsius, fahrenheit, or kelvin.'; + validate: target => { + if (units.includes(target.toLowerCase())) return true; + return `Invalid target, please enter either ${list(units, 'or')}.`; }, - parse: to => to.toLowerCase() + parse: target => target.toLowerCase() }, { key: 'amount', @@ -38,18 +40,19 @@ module.exports = class TemperatureCommand extends Command { } run(msg, args) { // eslint-disable-line consistent-return - const { base, to, amount } = args; - if (base === to) { - return msg.say(`Converting ${base} to ${to} is the same value, dummy.`); - } else if (base === 'celsius') { - if (to === 'fahrenheit') return msg.say(`${amount}°C is ${(amount * 1.8) + 32}°F.`); - else 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.`); - else 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.`); - else if (to === 'fahrenheit') return msg.say(`${amount}°K is ${(amount * 1.8) - 459.67}°F.`); + const { base, target, amount } = args; + if (base === target) return msg.say(`Converting ${base} to ${target} is the same value, dummy.`); + if (base === 'celsius') { + if (target === 'fahrenheit') return msg.say(`${amount}°C is ${(amount * 1.8) + 32}°F.`); + if (target === 'kelvin') return msg.say(`${amount}°C is ${amount + 273.15}°K.`); + } + if (base === 'fahrenheit') { + if (target === 'celsius') return msg.say(`${amount}°F is ${(amount - 32) / 1.8}°C.`); + if (target === 'kelvin') return msg.say(`${amount}°F is ${(amount + 459.67) * (5 / 9)}°K.`); + } + if (base === 'kelvin') { + if (target === 'celsius') return msg.say(`${amount}°K is ${amount - 273.15}°C.`); + if (target === 'fahrenheit') return msg.say(`${amount}°K is ${(amount * 1.8) - 459.67}°F.`); } } }; diff --git a/commands/random-res/magic-conch.js b/commands/random-res/magic-conch.js index 9cc7076f..39389a63 100644 --- a/commands/random-res/magic-conch.js +++ b/commands/random-res/magic-conch.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const { stripIndents } = require('common-tags'); -const answers = require('../../assets/json/magic-conch'); +const answers = ['Maybe someday', 'Nothing', 'Neither', 'I don\'t think so', 'Yes', 'Try asking again']; module.exports = class MagicConchCommand extends Command { constructor(client) { diff --git a/commands/random-res/name.js b/commands/random-res/name.js index b8e23283..6b7c231c 100644 --- a/commands/random-res/name.js +++ b/commands/random-res/name.js @@ -1,5 +1,7 @@ const Command = require('../../structures/Command'); const snekfetch = require('snekfetch'); +const { list } = require('../../structures/Util'); +const genders = ['male', 'female', 'both']; module.exports = class NameCommand extends Command { constructor(client) { @@ -11,12 +13,12 @@ module.exports = class NameCommand extends Command { args: [ { key: 'gender', - prompt: 'Which gender do you want to generate a name for?', + prompt: `Which gender do you want to generate a name for? Either ${list(genders, 'or')}.`, type: 'string', default: 'both', validate: gender => { - if (['male', 'female', 'both'].includes(gender.toLowerCase())) return true; - return 'Please enter either male, female, or both.'; + if (genders.includes(gender.toLowerCase())) return true; + return `Invalid gender, please enter either ${list(genders, 'or')}.`; }, parse: gender => gender.toLowerCase() } diff --git a/commands/random-res/today.js b/commands/random-res/today.js index 64c3b0a7..95b190cf 100644 --- a/commands/random-res/today.js +++ b/commands/random-res/today.js @@ -38,7 +38,7 @@ module.exports = class TodayCommand extends Command { .setDescription(`${event.year}: ${event.text}`); return msg.embed(embed); } catch (err) { - if (err.status === 404 || err.status === 500) return msg.say('Invalid Date.'); + if (err.status === 404 || err.status === 500) return msg.say('Invalid date.'); throw err; } } diff --git a/commands/random/horoscope.js b/commands/random/horoscope.js index c7348ce0..e0102668 100644 --- a/commands/random/horoscope.js +++ b/commands/random/horoscope.js @@ -1,6 +1,7 @@ const Command = require('../../structures/Command'); const { MessageEmbed } = require('discord.js'); const snekfetch = require('snekfetch'); +const { list } = require('../../structures/Util'); const signs = require('../../assets/json/horoscope'); module.exports = class HoroscopeCommand extends Command { @@ -15,11 +16,11 @@ module.exports = class HoroscopeCommand extends Command { args: [ { key: 'sign', - prompt: 'Which sign would you like to get the horoscope for?', + prompt: `Which sign would you like to get the horoscope for? Either ${list(signs, 'or')}.`, type: 'string', validate: sign => { if (signs.includes(sign.toLowerCase())) return true; - return 'Invalid sign. Use `help horoscope` for a list of signs.'; + return `Invalid sign, please enter either ${list(signs, 'or')}.`; }, parse: sign => sign.toLowerCase() } diff --git a/commands/random/soundboard.js b/commands/random/soundboard.js index 7255c4ac..82a52fa8 100644 --- a/commands/random/soundboard.js +++ b/commands/random/soundboard.js @@ -1,6 +1,7 @@ const Command = require('../../structures/Command'); -const sounds = require('../../assets/json/soundboard'); +const { list } = require('../../structures/Util'); const path = require('path'); +const sounds = ['airhorn', 'cat', 'dun-dun-dun', 'pikachu', 'space']; module.exports = class SoundboardCommand extends Command { constructor(client) { @@ -20,14 +21,13 @@ module.exports = class SoundboardCommand extends Command { args: [ { key: 'sound', - prompt: 'What sound would you like to play?', + prompt: `What sound would you like to play? Either ${list(sounds, 'or')}.`, type: 'string', - default: sounds[Math.floor(Math.random() * sounds.length)], validate: sound => { if (sounds.includes(sound.toLowerCase())) return true; - return 'Invalid Sound. Use `help soundboard` for a list of sounds.'; + return `Invalid sound, please enter either ${list(sounds, 'or')}.`; }, - parse: sound => path.join(__dirname, '..', '..', 'assets', 'sounds', `${sound.toLowerCase()}.mp3`) + parse: sound => sound.toLowerCase() } ] }); @@ -44,7 +44,7 @@ module.exports = class SoundboardCommand extends Command { if (this.client.voiceConnections.has(channel.guild.id)) return msg.say('I am already playing a sound.'); const connection = await channel.join(); await msg.react('🔊'); - const dispatcher = connection.playFile(sound, { volume: 0.25 }); + const dispatcher = connection.playFile(path.join(__dirname, '..', '..', 'assets', 'sounds', `${sound}.mp3`)); dispatcher.once('end', () => { channel.leave(); msg.react('✅'); diff --git a/commands/random/strawpoll.js b/commands/random/strawpoll.js index f0b82063..c4fe3483 100644 --- a/commands/random/strawpoll.js +++ b/commands/random/strawpoll.js @@ -6,6 +6,7 @@ module.exports = class StrawpollCommand extends Command { constructor(client) { super(client, { name: 'strawpoll', + aliases: ['poll'], group: 'random', memberName: 'strawpoll', description: 'Creates a Strawpoll from the options you provide.', @@ -16,7 +17,7 @@ module.exports = class StrawpollCommand extends Command { type: 'string', validate: title => { if (title.length < 200) return true; - return 'Title must be under 200 characters.'; + return 'Please keep the title under 200 characters.'; } }, { @@ -26,7 +27,7 @@ module.exports = class StrawpollCommand extends Command { infinite: true, validate: choice => { if (choice.length < 140) return true; - return 'Choices must be under 140 characters each.'; + return 'Please keep choices under 140 characters each.'; } } ] @@ -35,14 +36,14 @@ 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('Please provide more than one choice.'); + if (options.length > 31) return msg.say('Please provide thirty or less choices.'); const { body } = await snekfetch .post('https://strawpoll.me/api/v2/polls') .send({ title, options }); return msg.say(stripIndents` ${body.title} - http://strawpoll.me/${body.id} + http://www.strawpoll.me/${body.id} `); } }; diff --git a/commands/random/xkcd.js b/commands/random/xkcd.js index 0d2b8f7e..5e575434 100644 --- a/commands/random/xkcd.js +++ b/commands/random/xkcd.js @@ -35,7 +35,8 @@ module.exports = class XKCDCommand extends Command { .setImage(current.body.img) .setFooter(current.body.alt); return msg.embed(embed); - } else if (type === 'random') { + } + if (type === 'random') { const random = Math.floor(Math.random() * current.body.num) + 1; const { body } = await snekfetch .get(`https://xkcd.com/${random}/info.0.json`); @@ -46,18 +47,17 @@ module.exports = class XKCDCommand extends Command { .setImage(body.img) .setFooter(body.alt); return msg.embed(embed); - } else { - const choice = parseInt(type, 10); - if (isNaN(choice) || current.body.num < choice || choice < 1) return msg.say('Invalid Number.'); - const { body } = await snekfetch - .get(`https://xkcd.com/${choice}/info.0.json`); - const embed = new MessageEmbed() - .setTitle(`${body.num} - ${body.title}`) - .setColor(0x9797FF) - .setURL(`https://xkcd.com/${body.num}`) - .setImage(body.img) - .setFooter(body.alt); - return msg.embed(embed); } + const choice = parseInt(type, 10); + if (isNaN(choice) || current.body.num < choice || choice < 1) return msg.say('Invalid number.'); + const { body } = await snekfetch + .get(`https://xkcd.com/${choice}/info.0.json`); + const embed = new MessageEmbed() + .setTitle(`${body.num} - ${body.title}`) + .setColor(0x9797FF) + .setURL(`https://xkcd.com/${body.num}`) + .setImage(body.img) + .setFooter(body.alt); + return msg.embed(embed); } }; diff --git a/commands/search/anime.js b/commands/search/anime.js index 5d63ae06..7fde0710 100644 --- a/commands/search/anime.js +++ b/commands/search/anime.js @@ -49,7 +49,7 @@ module.exports = class AnimeCommand extends Command { anime.entry[0].end_date[0], true); return msg.embed(embed); } catch (err) { - if (err.message === 'Parse Error') return msg.say('No Results.'); + if (err.message === 'Parse Error') return msg.say('Could not find any results.'); throw err; } } diff --git a/commands/search/bot-info.js b/commands/search/bot-info.js index 75b23abf..f1e20895 100644 --- a/commands/search/bot-info.js +++ b/commands/search/bot-info.js @@ -9,12 +9,12 @@ module.exports = class BotSearchCommand extends Command { name: 'bot-info', group: 'search', memberName: 'bot-info', - description: 'Searches Discord Bots for info on a bot.', + description: 'Searches Discord Bots for information on a bot.', clientPermissions: ['EMBED_LINKS'], args: [ { key: 'bot', - prompt: 'Which bot do you want to get information for?', + prompt: 'Which bot do you want to get information on?', type: 'user' } ] @@ -41,7 +41,7 @@ module.exports = class BotSearchCommand extends Command { body.prefix, true); return msg.embed(embed); } catch (err) { - if (err.status === 404) return msg.say('Bot Not Found.'); + if (err.status === 404) return msg.say('Could not find any results.'); throw err; } } diff --git a/commands/search/bulbapedia.js b/commands/search/bulbapedia.js index e21b9834..1cbe7c14 100644 --- a/commands/search/bulbapedia.js +++ b/commands/search/bulbapedia.js @@ -15,7 +15,7 @@ module.exports = class BulbapediaCommand extends Command { args: [ { key: 'query', - prompt: 'What would you like to search for?', + prompt: 'What article would you like to search for?', type: 'string' } ] @@ -36,7 +36,7 @@ module.exports = class BulbapediaCommand extends Command { redirects: '', formatversion: 2 }); - if (body.query.pages[0].missing) return msg.say('No Results.'); + if (body.query.pages[0].missing) return msg.say('Could not find any results.'); const embed = new MessageEmbed() .setColor(0x3E7614) .setTitle(body.query.pages[0].title) diff --git a/commands/search/define.js b/commands/search/define.js index 1ac7af85..89cd215b 100644 --- a/commands/search/define.js +++ b/commands/search/define.js @@ -32,7 +32,7 @@ module.exports = class DefineCommand extends Command { useCanonical: false, api_key: WORDNIK_KEY }); - if (!body.length) return msg.say('No Results.'); + if (!body.length) return msg.say('Could not find any results.'); const embed = new MessageEmbed() .setColor(0x9797FF) .setTitle(body[0].word) diff --git a/commands/search/discrim.js b/commands/search/discrim.js index 274616c7..7a572882 100644 --- a/commands/search/discrim.js +++ b/commands/search/discrim.js @@ -29,7 +29,7 @@ module.exports = class DiscrimCommand extends Command { const discrim = args.discrim || msg.author.discriminator; const users = this.client.users.filter(user => user.discriminator === discrim).map(user => user.username); const embed = new MessageEmbed() - .setTitle(`${users.length} Users with the discriminator: ${discrim}`) + .setTitle(`${users.length} Users with the discriminator #${discrim}`) .setColor(0x9797FF) .setDescription(users.join(', ')); return msg.embed(embed); diff --git a/commands/search/forecast.js b/commands/search/forecast.js index fad44384..0e83619e 100644 --- a/commands/search/forecast.js +++ b/commands/search/forecast.js @@ -29,7 +29,7 @@ module.exports = class ForecastCommand extends Command { q: `select * from weather.forecast where u='f' AND woeid in (select woeid from geo.places(1) where text="${query}")`, // eslint-disable-line max-len format: 'json' }); - if (!body.query.count) return msg.say('Location Not Found.'); + if (!body.query.count) return msg.say('Could not find any results.'); const forecasts = body.query.results.channel.item.forecast; const embed = new MessageEmbed() .setColor(0x0000FF) diff --git a/commands/search/giphy.js b/commands/search/giphy.js index 36dd50f2..c793fbc2 100644 --- a/commands/search/giphy.js +++ b/commands/search/giphy.js @@ -12,7 +12,7 @@ module.exports = class GiphyCommand extends Command { args: [ { key: 'query', - prompt: 'What would you like to search for?', + prompt: 'What GIF would you like to search for?', type: 'string' } ] diff --git a/commands/search/github.js b/commands/search/github.js index 80cc5fb0..f347b27b 100644 --- a/commands/search/github.js +++ b/commands/search/github.js @@ -10,7 +10,7 @@ module.exports = class GitHubCommand extends Command { name: 'github', group: 'search', memberName: 'github', - description: 'Searches GitHub for info on a GitHub repository.', + description: 'Searches GitHub for information on a repository.', clientPermissions: ['EMBED_LINKS'], args: [ { @@ -20,7 +20,7 @@ module.exports = class GitHubCommand extends Command { }, { key: 'repository', - prompt: 'What is the name of the repository you would like to get information for?', + prompt: 'What is the name of the repository?', type: 'string' } ] @@ -37,7 +37,7 @@ module.exports = class GitHubCommand extends Command { .setAuthor('GitHub', 'https://i.imgur.com/bRROLzk.png') .setTitle(body.full_name) .setURL(body.html_url) - .setDescription(body.description || 'No Description.') + .setDescription(body.description || 'No description.') .setThumbnail(body.owner.avatar_url || null) .addField('❯ Stars', body.stargazers_count, true) @@ -53,7 +53,7 @@ module.exports = class GitHubCommand extends Command { moment(body.updated_at).format('MMMM Do YYYY'), true); return msg.embed(embed); } catch (err) { - if (err.status === 404) return msg.say('Not Found.'); + if (err.status === 404) return msg.say('Could not find the repository.'); throw err; } } diff --git a/commands/search/manga.js b/commands/search/manga.js index c39e8d68..3b425fa3 100644 --- a/commands/search/manga.js +++ b/commands/search/manga.js @@ -49,7 +49,7 @@ module.exports = class MangaCommand extends Command { manga.entry[0].end_date[0], true); return msg.embed(embed); } catch (err) { - if (err.message === 'Parse Error') return msg.say('No Results.'); + if (err.message === 'Parse Error') return msg.say('Could not find any results.'); throw err; } } diff --git a/commands/search/map.js b/commands/search/map.js index 2962de5a..159de62b 100644 --- a/commands/search/map.js +++ b/commands/search/map.js @@ -14,16 +14,16 @@ module.exports = class MapCommand extends Command { { key: 'zoom', label: 'zoom level', - prompt: 'What would you like the zoom level for the map to be? Limit 1-20.', + prompt: 'What would you like the zoom level to be? Must be a number from 1-20.', type: 'integer', validate: zoom => { if (zoom < 21 && zoom > 0) return true; - return 'Please enter a zoom value from 1-20'; + return 'Please enter a zoom value from 1-20.'; } }, { key: 'query', - prompt: 'What location you like to get a map image for?', + prompt: 'What location would you like to get a map of?', type: 'string' } ] diff --git a/commands/search/movie.js b/commands/search/movie.js index 11406981..2140687b 100644 --- a/commands/search/movie.js +++ b/commands/search/movie.js @@ -16,7 +16,7 @@ module.exports = class MovieCommand extends Command { args: [ { key: 'query', - prompt: 'What would you like to search for?', + prompt: 'What movie would you like to search for?', type: 'string' } ] @@ -32,7 +32,7 @@ module.exports = class MovieCommand extends Command { include_adult: msg.channel.nsfw || false, query }); - if (!search.body.results.length) return msg.say('No Results.'); + if (!search.body.results.length) return msg.say('Could not find any results.'); const { body } = await snekfetch .get(`https://api.themoviedb.org/3/movie/${search.body.results[0].id}`) .query({ api_key: TMDB_KEY }); diff --git a/commands/search/neopet.js b/commands/search/neopet.js index d6a1b6b7..1b69c7b6 100644 --- a/commands/search/neopet.js +++ b/commands/search/neopet.js @@ -11,7 +11,7 @@ module.exports = class NeopetCommand extends Command { args: [ { key: 'query', - prompt: 'What pet would you like to get the image of?', + prompt: 'What pet would you like to get an image of?', type: 'string' } ] @@ -28,7 +28,7 @@ module.exports = class NeopetCommand extends Command { mood: 1 }); const link = text.match(/http:\/\/pets\.neopets\.com\/cp\/.+\.png/); - if (!link) return msg.say('Invalid Pet Name.'); + if (!link) return msg.say('Could not find any results.'); return msg.say(link[0]); } }; diff --git a/commands/search/npm.js b/commands/search/npm.js index 3988a753..aa687e6d 100644 --- a/commands/search/npm.js +++ b/commands/search/npm.js @@ -15,7 +15,7 @@ module.exports = class NPMCommand extends Command { args: [ { key: 'query', - prompt: 'What package do you want to get information for?', + prompt: 'What package would you like to search for?', type: 'string' } ] @@ -51,7 +51,7 @@ module.exports = class NPMCommand extends Command { body.maintainers.map(user => user.name).join(', ')); return msg.embed(embed); } catch (err) { - if (err.status === 404) return msg.say('Not Found.'); + if (err.status === 404) return msg.say('Could not find any results.'); throw err; } } diff --git a/commands/search/osu.js b/commands/search/osu.js index fefc5ca9..0bf22ca7 100644 --- a/commands/search/osu.js +++ b/commands/search/osu.js @@ -14,7 +14,7 @@ module.exports = class OsuCommand extends Command { args: [ { key: 'query', - prompt: 'What osu username would you like to search for?', + prompt: 'What user would you like to get information on?', type: 'string' } ] @@ -30,7 +30,7 @@ module.exports = class OsuCommand extends Command { u: query, type: 'string' }); - if (!body.length) return msg.say('No Results.'); + if (!body.length) return msg.say('Could not find any results.'); const embed = new MessageEmbed() .setColor(0xFF66AA) .setAuthor('osu!', 'https://i.imgur.com/EmnUp00.png') @@ -40,25 +40,25 @@ module.exports = class OsuCommand extends Command { .addField('❯ ID', body[0].user_id, true) .addField('❯ Level', - body[0].level, true) + body[0].level || 'N/A', true) .addField('❯ Accuracy', - body[0].accuracy, true) + body[0].accuracy || 'N/A', true) .addField('❯ Rank', - body[0].pp_rank, true) + body[0].pp_rank || 'N/A', true) .addField('❯ Play Count', - body[0].playcount, true) + body[0].playcount || 'N/A', true) .addField('❯ Country', body[0].country || 'N/A', true) .addField('❯ Ranked Score', - body[0].ranked_score, true) + body[0].ranked_score || 'N/A', true) .addField('❯ Total Score', - body[0].total_score, true) + body[0].total_score || 'N/A', true) .addField('❯ SS', - body[0].count_rank_ss, true) + body[0].count_rank_ss || 'N/A', true) .addField('❯ S', - body[0].count_rank_s, true) + body[0].count_rank_s || 'N/A', true) .addField('❯ A', - body[0].count_rank_a, true); + body[0].count_rank_a || 'N/A', true); return msg.embed(embed); } }; diff --git a/commands/search/pokedex.js b/commands/search/pokedex.js index 93778d39..9b1bc32c 100644 --- a/commands/search/pokedex.js +++ b/commands/search/pokedex.js @@ -16,9 +16,9 @@ module.exports = class PokedexCommand extends Command { args: [ { key: 'pokemon', - prompt: 'What Pokémon would you like to search for?', + prompt: 'What Pokémon would you like to get information on?', type: 'string', - parse: pokemon => pokemon.toLowerCase().replace(/[ ]/g, '-') + parse: pokemon => pokemon.toLowerCase().replace(/ /g, '-') } ] }); @@ -41,7 +41,7 @@ module.exports = class PokedexCommand extends Command { .setThumbnail(`https://www.serebii.net/sunmoon/pokemon/${id}.png`); return msg.embed(embed); } catch (err) { - if (err.status === 404) return msg.say('Pokémon Not Found.'); + if (err.status === 404) return msg.say('Could not find any results.'); throw err; } } diff --git a/commands/search/recipe.js b/commands/search/recipe.js index 05bce603..e8dd966d 100644 --- a/commands/search/recipe.js +++ b/commands/search/recipe.js @@ -13,7 +13,7 @@ module.exports = class RecipeCommand extends Command { args: [ { key: 'query', - prompt: 'What would you like to search for?', + prompt: 'What recipe would you like to search for?', type: 'string' } ] @@ -27,7 +27,7 @@ module.exports = class RecipeCommand extends Command { .get('http://www.recipepuppy.com/api/') .query({ q: query }); const body = JSON.parse(text); - if (!body.results.length) return msg.say('No Results.'); + if (!body.results.length) return msg.say('Could not find any results.'); const recipe = body.results[Math.floor(Math.random() * body.results.length)]; const embed = new MessageEmbed() .setColor(0xC20000) @@ -37,7 +37,7 @@ module.exports = class RecipeCommand extends Command { .setThumbnail(recipe.thumbnail); return msg.embed(embed); } catch (err) { - return msg.say('No Results.'); + return msg.say('Could not find any results.'); } } }; diff --git a/commands/search/reddit.js b/commands/search/reddit.js index 9abb8786..e626ce5b 100644 --- a/commands/search/reddit.js +++ b/commands/search/reddit.js @@ -13,7 +13,7 @@ module.exports = class RedditCommand extends Command { args: [ { key: 'subreddit', - prompt: 'What subreddit would you like to get data for?', + prompt: 'What subreddit would you like to get a post from?', type: 'string' } ] @@ -26,10 +26,10 @@ module.exports = class RedditCommand extends Command { const { body } = await snekfetch .get(`https://www.reddit.com/r/${subreddit}/new.json`) .query({ sort: 'new' }); - if (!body.data.children.length) return msg.say('Subreddit Not Found.'); + if (!body.data.children.length) return msg.say('Could not find any results.'); const post = body.data.children[Math.floor(Math.random() * body.data.children.length)]; if (!post.data) return msg.say('This post has no data, try again!'); - if (!msg.channel.nsfw && post.data.over_18) return msg.say('This post is only viewable in NSFW Channels.'); + if (!msg.channel.nsfw && post.data.over_18) return msg.say('This post is only viewable in NSFW channels.'); const embed = new MessageEmbed() .setColor(0xFF4500) .setAuthor('Reddit', 'https://i.imgur.com/V6hXniU.png') @@ -45,8 +45,8 @@ module.exports = class RedditCommand extends Command { post.data.score, true); return msg.embed(embed); } catch (err) { - if (err.status === 403) return msg.say('This Subreddit is Private.'); - if (err.status === 404) return msg.say('Subreddit Not Found.'); + if (err.status === 403) return msg.say('This subreddit is private.'); + if (err.status === 404) return msg.say('Could not find the subreddit.'); throw err; } } diff --git a/commands/search/soundcloud.js b/commands/search/soundcloud.js index de24fad0..2cc3e365 100644 --- a/commands/search/soundcloud.js +++ b/commands/search/soundcloud.js @@ -14,7 +14,7 @@ module.exports = class SoundCloudCommand extends Command { args: [ { key: 'query', - prompt: 'What do you want to search SoundCloud for?', + prompt: 'What song would you like to search for?', type: 'string' } ] diff --git a/commands/search/steam.js b/commands/search/steam.js index a1870682..174f3895 100644 --- a/commands/search/steam.js +++ b/commands/search/steam.js @@ -29,7 +29,7 @@ module.exports = class SteamCommand extends Command { l: 'en', term: query }); - if (!body.total) return msg.say('No Results.'); + if (!body.total) return msg.say('Could not find any results.'); const current = body.items[0].price ? body.items[0].price.final / 100 : 0.00; const original = body.items[0].price ? body.items[0].price.initial / 100 : 0.00; const price = current === original ? `$${current}` : `~~$${original}~~ $${current}`; diff --git a/commands/search/tv-show.js b/commands/search/tv-show.js index 44e1095d..181827cb 100644 --- a/commands/search/tv-show.js +++ b/commands/search/tv-show.js @@ -16,7 +16,7 @@ module.exports = class TVShowCommand extends Command { args: [ { key: 'query', - prompt: 'What would you like to search for?', + prompt: 'What TV show would you like to search for?', type: 'string' } ] @@ -32,7 +32,7 @@ module.exports = class TVShowCommand extends Command { include_adult: msg.channel.nsfw || false, query }); - if (!search.body.results.length) return msg.say('No Results.'); + if (!search.body.results.length) return msg.say('Could not find any results.'); const { body } = await snekfetch .get(`https://api.themoviedb.org/3/tv/${search.body.results[0].id}`) .query({ api_key: TMDB_KEY }); diff --git a/commands/search/urban.js b/commands/search/urban.js index fe2f886e..10ef0710 100644 --- a/commands/search/urban.js +++ b/commands/search/urban.js @@ -26,7 +26,7 @@ module.exports = class UrbanCommand extends Command { const { body } = await snekfetch .get('http://api.urbandictionary.com/v0/define') .query({ term: query }); - if (!body.list.length) return msg.say('No Results.'); + if (!body.list.length) return msg.say('Could not find any results.'); const embed = new MessageEmbed() .setColor(0x32A8F0) .setAuthor('Urban Dictionary', 'https://i.imgur.com/fzFuuL7.png') diff --git a/commands/search/vocaloid.js b/commands/search/vocaloid.js index 11a06ad3..cc93cc13 100644 --- a/commands/search/vocaloid.js +++ b/commands/search/vocaloid.js @@ -35,7 +35,7 @@ module.exports = class VocaloidCommand extends Command { nameMatchMode: 'Words', fields: 'ThumbUrl,Lyrics' }); - if (!body.totalCount) return msg.say('No Results.'); + if (!body.totalCount) return msg.say('Could not find any results.'); const embed = new MessageEmbed() .setColor(0x86D2D0) .setAuthor('VocaDB', 'https://i.imgur.com/9Tx9UIc.jpg') diff --git a/commands/search/wattpad.js b/commands/search/wattpad.js index df220356..40f5b357 100644 --- a/commands/search/wattpad.js +++ b/commands/search/wattpad.js @@ -32,7 +32,7 @@ module.exports = class WattpadCommand extends Command { limit: 1 }) .set({ Authorization: `Basic ${WATTPAD_KEY}` }); - if (!body.stories.length) return msg.say('No Results.'); + if (!body.stories.length) return msg.say('Could not find any results.'); const embed = new MessageEmbed() .setColor(0xF89C34) .setAuthor('Wattpad', 'https://i.imgur.com/Rw9vRQB.png') diff --git a/commands/search/weather.js b/commands/search/weather.js index b78b7f95..3948309b 100644 --- a/commands/search/weather.js +++ b/commands/search/weather.js @@ -13,7 +13,7 @@ module.exports = class WeatherCommand extends Command { args: [ { key: 'query', - prompt: 'What location would you like to get the current weather for?', + prompt: 'What location would you like to get the weather of?', type: 'string' } ] @@ -28,7 +28,7 @@ module.exports = class WeatherCommand extends Command { q: `select * from weather.forecast where u='f' AND woeid in (select woeid from geo.places(1) where text="${query}")`, // eslint-disable-line max-len format: 'json' }); - if (!body.query.count) return msg.say('Location Not Found.'); + if (!body.query.count) return msg.say('Could not find any results.'); const embed = new MessageEmbed() .setColor(0x0000FF) .setAuthor(body.query.results.channel.title, 'https://i.imgur.com/2MT0ViC.png') diff --git a/commands/search/wikia.js b/commands/search/wikia.js index 86806e96..eef5b806 100644 --- a/commands/search/wikia.js +++ b/commands/search/wikia.js @@ -15,12 +15,12 @@ module.exports = class WikiaCommand extends Command { args: [ { key: 'wiki', - prompt: 'What is the subdomain of the wikia you want to search?', + prompt: 'What is the subdomain of the wiki you want to search?', type: 'string' }, { key: 'query', - prompt: 'What would you like to search for?', + prompt: 'What article would you like to search for?', type: 'string' } ] @@ -49,7 +49,7 @@ module.exports = class WikiaCommand extends Command { .setThumbnail(body.sections[0].images.length ? body.sections[0].images[0].src : null); return msg.embed(embed); } catch (err) { - return msg.say('No Results or Invalid Wiki.'); + return msg.say('Could not find any results.'); } } }; diff --git a/commands/search/wikipedia.js b/commands/search/wikipedia.js index 67b85dd4..a4f024bc 100644 --- a/commands/search/wikipedia.js +++ b/commands/search/wikipedia.js @@ -14,7 +14,7 @@ module.exports = class WikipediaCommand extends Command { args: [ { key: 'query', - prompt: 'What would you like to search for?', + prompt: 'What article would you like to search for?', type: 'string' } ] @@ -35,7 +35,7 @@ module.exports = class WikipediaCommand extends Command { redirects: '', formatversion: 2 }); - if (body.query.pages[0].missing) return msg.say('No Results.'); + if (body.query.pages[0].missing) return msg.say('Could not find any results.'); const embed = new MessageEmbed() .setColor(0xE7E7E7) .setTitle(body.query.pages[0].title) diff --git a/commands/search/youtube.js b/commands/search/youtube.js index c3996456..d9102967 100644 --- a/commands/search/youtube.js +++ b/commands/search/youtube.js @@ -14,7 +14,7 @@ module.exports = class YouTubeCommand extends Command { args: [ { key: 'query', - prompt: 'What would you like to search for?', + prompt: 'What video would you like to search for?', type: 'string' } ] @@ -32,7 +32,7 @@ module.exports = class YouTubeCommand extends Command { q: query, key: GOOGLE_KEY }); - if (!body.items.length) return msg.say('No Results.'); + if (!body.items.length) return msg.say('Could not find any results.'); const embed = new MessageEmbed() .setColor(0xDD2825) .setTitle(body.items[0].snippet.title) diff --git a/commands/search/yu-gi-oh.js b/commands/search/yu-gi-oh.js index 93d41327..ca7abbe6 100644 --- a/commands/search/yu-gi-oh.js +++ b/commands/search/yu-gi-oh.js @@ -13,7 +13,7 @@ module.exports = class YuGiOhCommand extends Command { args: [ { key: 'query', - prompt: 'What card would you like to get data for?', + prompt: 'What card would you like to get information on?', type: 'string', parse: text => encodeURIComponent(text) } @@ -25,7 +25,7 @@ module.exports = class YuGiOhCommand extends Command { const { query } = args; const { body } = await snekfetch .get(`http://yugiohprices.com/api/card_data/${query}`); - if (body.status === 'fail') return msg.say('No Results.'); + if (body.status === 'fail') return msg.say('Could not find any results.'); const embed = new MessageEmbed() .setColor(0xBE5F1F) .setTitle(body.data.name) diff --git a/commands/text-edit/binary.js b/commands/text-edit/binary.js index 03775815..0a8e7aa1 100644 --- a/commands/text-edit/binary.js +++ b/commands/text-edit/binary.js @@ -27,12 +27,9 @@ module.exports = class BinaryCommand extends Command { } binary(text) { - return unescape(encodeURIComponent(text)) - .split('') - .map(str => { - const converted = str.charCodeAt(0).toString(2); - return `${'00000000'.slice(converted.length)}${converted}`; - }) - .join(''); + return text.split('').map(str => { + const converted = str.charCodeAt(0).toString(2); + return `${'00000000'.slice(converted.length)}${converted}`; + }).join(''); } }; diff --git a/commands/text-edit/cow-say.js b/commands/text-edit/cow-say.js index 41747020..3e0aac8c 100644 --- a/commands/text-edit/cow-say.js +++ b/commands/text-edit/cow-say.js @@ -7,7 +7,7 @@ module.exports = class CowsayCommand extends Command { name: 'cow-say', group: 'text-edit', memberName: 'cow-say', - description: 'Converts text to cowsay.', + description: 'Converts text to cow-say.', args: [ { key: 'text', diff --git a/commands/text-edit/say.js b/commands/text-edit/say.js index 232dfcaf..d5f48a0e 100644 --- a/commands/text-edit/say.js +++ b/commands/text-edit/say.js @@ -8,7 +8,6 @@ module.exports = class SayCommand extends Command { group: 'text-edit', memberName: 'say', description: 'Make XiaoBot say what you wish.', - guildOnly: true, args: [ { key: 'text', @@ -19,9 +18,9 @@ module.exports = class SayCommand extends Command { }); } - run(msg, args) { + async run(msg, args) { const { text } = args; - if (msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES')) msg.delete(); + if (msg.guild && msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES')) await msg.delete(); return msg.say(text); } }; diff --git a/commands/text-edit/translate.js b/commands/text-edit/translate.js index 7456471a..fb288598 100644 --- a/commands/text-edit/translate.js +++ b/commands/text-edit/translate.js @@ -1,6 +1,7 @@ const Command = require('../../structures/Command'); const { MessageEmbed } = require('discord.js'); const snekfetch = require('snekfetch'); +const { list } = require('../../structures/Util'); const codes = require('../../assets/json/translate'); const { YANDEX_KEY } = process.env; @@ -11,7 +12,7 @@ module.exports = class TranslateCommand extends Command { group: 'text-edit', memberName: 'translate', description: 'Translates text to a specified language.', - details: '**Codes:** https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/#languages', + details: `**Codes:** ${Object.keys(codes).join(', ')}`, clientPermissions: ['EMBED_LINKS'], args: [ { @@ -20,42 +21,42 @@ module.exports = class TranslateCommand extends Command { type: 'string', validate: text => { if (text.length < 500) return true; - return 'Text must be under 500 characters.'; + return 'Please keep text under 500 characters.'; } }, { - key: 'to', - prompt: 'Which language is being translated to?', + key: 'target', + prompt: 'Which language would you like to translate to?', type: 'string', - validate: to => { - if (codes[to.toLowerCase()]) return true; - return 'Invalid Language Code. Use `help translate` for a list of codes.'; + validate: target => { + if (codes[target.toLowerCase()]) return true; + return `Invalid target, please enter either ${list(Object.keys(codes), 'or')}.`; }, - parse: to => to.toLowerCase() + parse: target => target.toLowerCase() }, { - key: 'from', - prompt: 'Which language is being translated from?', + key: 'original', + prompt: 'Which language is your text in?', type: 'string', default: '', - validate: from => { - if (codes[from.toLowerCase()]) return true; - return 'Invalid Language Code. Use `help translate` for a list of codes.'; + validate: original => { + if (codes[original.toLowerCase()]) return true; + return `Invalid original, please enter either ${list(Object.keys(codes), 'or')}.`; }, - parse: from => from.toLowerCase() + parse: original => original.toLowerCase() } ] }); } async run(msg, args) { - const { text, to, from } = args; + const { text, target, original } = args; const { body } = await snekfetch .get('https://translate.yandex.net/api/v1.5/tr.json/translate') .query({ key: YANDEX_KEY, text, - lang: from ? `${from}-${to}` : to + lang: original ? `${original}-${target}` : target }); const lang = body.lang.split('-'); const embed = new MessageEmbed() diff --git a/commands/text-edit/webhook.js b/commands/text-edit/webhook.js index 9c69f9d3..26fbe342 100644 --- a/commands/text-edit/webhook.js +++ b/commands/text-edit/webhook.js @@ -10,9 +10,7 @@ module.exports = class WebhookCommand extends Command { group: 'text-edit', memberName: 'webhook', description: 'Posts a message to the webhook defined in your `process.env`.', - guildOnly: true, ownerOnly: true, - clientPermissions: ['MANAGE_MESSAGES'], args: [ { key: 'content', @@ -25,7 +23,7 @@ module.exports = class WebhookCommand extends Command { async run(msg, args) { const { content } = args; - msg.delete(); + if (msg.guild && msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES')) await msg.delete(); await snekfetch .post(WEBHOOK_URL) .send({ content }); diff --git a/commands/text-edit/yoda.js b/commands/text-edit/yoda.js index 20a7e618..06ba5612 100644 --- a/commands/text-edit/yoda.js +++ b/commands/text-edit/yoda.js @@ -17,7 +17,7 @@ module.exports = class YodaCommand extends Command { type: 'string', validate: sentence => { if (sentence.length < 500) return true; - return 'Text must be under 500 characters.'; + return 'Please keep text under 500 characters.'; } } ] diff --git a/commands/text-edit/zalgo.js b/commands/text-edit/zalgo.js index 742ee378..feb3779b 100644 --- a/commands/text-edit/zalgo.js +++ b/commands/text-edit/zalgo.js @@ -7,7 +7,7 @@ module.exports = class ZalgoCommand extends Command { name: 'zalgo', group: 'text-edit', memberName: 'zalgo', - description: 'Converts text to Zalgo.', + description: 'Converts text to zalgo.', args: [ { key: 'text', @@ -15,7 +15,7 @@ module.exports = class ZalgoCommand extends Command { type: 'string', validate: text => { if (text.length < 500) return true; - return 'Text must be under 500 characters.'; + return 'Please keep text under 500 characters.'; } } ] diff --git a/commands/user-info/user-info.js b/commands/user-info/user-info.js index 574e189a..9bd1868e 100644 --- a/commands/user-info/user-info.js +++ b/commands/user-info/user-info.js @@ -1,7 +1,12 @@ const Command = require('../../structures/Command'); const { MessageEmbed } = require('discord.js'); const moment = require('moment'); -const statuses = require('../../assets/json/user-info'); +const statuses = { + online: '<:online:313956277808005120> Online', + idle: '<:away:313956277220802560> Idle', + dnd: '<:dnd:313956276893646850> Do Not Disturb', + offline: '<:offline:313956277237710868> Offline' +}; module.exports = class UserInfoCommand extends Command { constructor(client) { @@ -16,7 +21,7 @@ module.exports = class UserInfoCommand extends Command { args: [ { key: 'member', - prompt: 'Which user would you like to get info on?', + prompt: 'Which user would you like to get information on?', type: 'member', default: '' } @@ -38,9 +43,9 @@ module.exports = class UserInfoCommand extends Command { .addField('❯ Server Join Date', moment(member.joinedTimestamp).format('MMMM Do YYYY'), true) .addField('❯ Status', - statuses[member.user.presence.status], true) + statuses[member.presence.status], true) .addField('❯ Playing', - member.user.presence.game ? member.user.presence.game.name : 'N/A', true) + member.presence.game ? member.presence.game.name : 'N/A', true) .addField('❯ Highest Role', member.highestRole.name !== '@everyone' ? member.highestRole.name : 'None', true) .addField('❯ Hoist Role', diff --git a/package.json b/package.json index 611a0781..e4a67fba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "31.1.4", + "version": "31.5.0", "description": "Your personal server companion.", "main": "Shard.js", "scripts": { diff --git a/structures/Command.js b/structures/Command.js index 1b23e8b5..98add5d5 100644 --- a/structures/Command.js +++ b/structures/Command.js @@ -22,14 +22,14 @@ class XiaoCommand extends Command { if (this.clientPermissions) { for (const permission of this.clientPermissions) { if (!msg.channel.permissionsFor(this.client.user).has(permission)) { - return `The \`${this.name}\` command requires me to have the \`${perms[permission]}\` Permission.`; + return `The \`${this.name}\` command requires me to have the \`${perms[permission]}\` permission.`; } } } if (this.userPermissions) { for (const permission of this.userPermissions) { if (!msg.channel.permissionsFor(msg.author).has(permission)) { - return `The \`${this.name}\` command requires you to have the \`${perms[permission]}\` Permission.`; + return `The \`${this.name}\` command requires you to have the \`${perms[permission]}\` permission.`; } } }