Lots of Changes

This commit is contained in:
Daniel Odendahl Jr
2017-08-26 01:20:43 +00:00
parent d2008c749d
commit 56e72f7509
78 changed files with 393 additions and 389 deletions
+2 -2
View File
@@ -5,7 +5,7 @@
"tag": "This command is *easter egg*, not *tag* :yum:", "tag": "This command is *easter egg*, not *tag* :yum:",
"easter egg": ":egg:", "easter egg": ":egg:",
"snek": "*Blame :snake:*", "snek": "*Blame :snake:*",
"snekfetch": "superagent is better.", "snekfetch": "The best.",
"xiaobot": "That's my name.", "xiaobot": "That's my name.",
"dragonfire535": "http://dragonfire535.tk", "dragonfire535": "http://dragonfire535.tk",
"heroes of dreamland": "https://www.wattpad.com/story/8712240-heroes-of-dreamland-book-1-kirby-and-the-monstrous", "heroes of dreamland": "https://www.wattpad.com/story/8712240-heroes-of-dreamland-book-1-kirby-and-the-monstrous",
@@ -32,7 +32,7 @@
"book1": "Book.", "book1": "Book.",
"new": "Nope, not quite yet.", "new": "Nope, not quite yet.",
"adam": "Adam pls.", "adam": "Adam pls.",
"token": "[READACTED]", "token": "[REDACTED]",
"nom": "https://cdn.discordapp.com/attachments/256055608279695360/308434352377954304/tumblr_ojzfs3jjoJ1qz64n4o1_540.gif", "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", "good vs evil": "https://cdn.discordapp.com/attachments/256055608279695360/308404323392684033/837631b64ef351ddabe8c2200c2feca54d81af62_hq.jpg",
"ebearskittychan": "The best :heart:", "ebearskittychan": "The best :heart:",
-8
View File
@@ -1,8 +0,0 @@
[
"Maybe someday",
"Nothing",
"Neither",
"I don't think so",
"Yes",
"Try asking again"
]
-38
View File
@@ -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
}
}
-14
View File
@@ -1,14 +0,0 @@
{
"filterLevels": [
"Off",
"No Role",
"Everyone"
],
"verificationLevels": [
"None",
"Low",
"Medium",
"(╯°□°)╯︵ ┻━┻",
"┻━┻ ミヽ(ಠ益ಠ)ノ彡┻━┻"
]
}
-7
View File
@@ -1,7 +0,0 @@
[
"airhorn",
"cat",
"dun-dun-dun",
"pikachu",
"space"
]
+32 -48
View File
@@ -1,48 +1,32 @@
{ [
"sentences": [ "The quick brown fox jumps over the lazy dog.",
"The quick brown fox jumps over the lazy dog.", "Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.",
"Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.", "How razorback-jumping frogs can level six piqued gymnasts!",
"How razorback-jumping frogs can level six piqued gymnasts!", "Amazingly few discotheques provide jukeboxes.",
"Amazingly few discotheques provide jukeboxes.", "I am so blue I'm greener than purple.",
"I am so blue I'm greener than purple.", "I stepped on a Corn Flake, now I'm a Cereal Killer.",
"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?",
"On a scale from one to ten what is your favourite colour of the alphabet?", "The sparkly lamp ate a pillow then punched Larry.",
"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.",
"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?",
"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!",
"There's a purple mushroom in my backyard, screaming Taco's!", "When life gives you lemons, chuck them at people you hate.",
"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.",
"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.",
"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.",
"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.",
"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?",
"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.",
"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.",
"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.",
"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 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.",
"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.",
"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.",
"The body may perhaps compensates for the loss of a true metaphysics.", "They got there early, and they got really good seats.",
"They got there early, and they got really good seats.", "Everyone was busy, so I went to the movie alone.",
"Everyone was busy, so I went to the movie alone.", "Yeah, I think it's a good environment for learning English.",
"Yeah, I think it's a good environment for learning English.", "I would have gotten the promotion, but my attendance wasnt good enough.",
"I would have gotten the promotion, but my attendance wasnt good enough.", "There were white out conditions in the town; subsequently, the roads were impassable.",
"There were white out conditions in the town; subsequently, the roads were impassable.", "If you like tuna and tomato sauce- try combining the two. Its really not as bad as it sounds."
"If you like tuna and tomato sauce- try combining the two. Its really not as bad as it sounds." ]
],
"difficulties": [
"easy",
"medium",
"hard",
"extreme",
"impossible"
],
"times": {
"easy": 25000,
"medium": 20000,
"hard": 15000,
"extreme": 10000,
"impossible": 5000
}
}
-6
View File
@@ -1,6 +0,0 @@
{
"online": "<:online:313956277808005120> Online",
"idle": "<:away:313956277220802560> Idle",
"dnd": "<:dnd:313956276893646850> Do Not Disturb",
"offline": "<:offline:313956277237710868> Offline"
}
+9 -10
View File
@@ -9,11 +9,10 @@ module.exports = class BattleCommand extends Command {
group: 'games', group: 'games',
memberName: 'battle', memberName: 'battle',
description: 'Engage in a turn-based battle against another user or the AI.', description: 'Engage in a turn-based battle against another user or the AI.',
guildOnly: true,
args: [ args: [
{ {
key: 'opponent', key: 'opponent',
prompt: 'Who would you like to battle?', prompt: 'What user would you like to battle?',
type: 'user', type: 'user',
default: '' default: ''
} }
@@ -26,17 +25,17 @@ module.exports = class BattleCommand extends Command {
async run(msg, args) { // eslint-disable-line complexity async run(msg, args) { // eslint-disable-line complexity
const opponent = args.opponent || this.client.user; const opponent = args.opponent || this.client.user;
if (opponent.id === msg.author.id) return msg.say('You may not fight yourself.'); 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.'); if (this.fighting.has(msg.channel.id)) return msg.say('Only one fight may be occurring per channel.');
this.fighting.add(msg.guild.id); this.fighting.add(msg.channel.id);
try { try {
if (!opponent.bot) { 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, { const verify = await msg.channel.awaitMessages(res => res.author.id === opponent.id, {
max: 1, max: 1,
time: 30000 time: 30000
}); });
if (!verify.size || !['yes', 'y'].includes(verify.first().content.toLowerCase())) { 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...'); return msg.say('Looks like they declined...');
} }
} }
@@ -65,7 +64,7 @@ module.exports = class BattleCommand extends Command {
await msg.say(stripIndents` await msg.say(stripIndents`
${user}, do you **fight**, **guard**, **special**, or **run**? ${user}, do you **fight**, **guard**, **special**, or **run**?
**${msg.author.username}**: ${userHP}HP **${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, { const turn = await msg.channel.awaitMessages(res => res.author.id === id, {
max: 1, 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.`); 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` return msg.say(stripIndents`
The match is over! The match is over!
**Winner:** ${userHP > oppoHP ? `${msg.author} (${userHP}HP)` : `${opponent} (${oppoHP}HP)`} **Winner:** ${userHP > oppoHP ? `${msg.author} (${userHP}HP)` : `${opponent} (${oppoHP}HP)`}
**Loser:** ${userHP > oppoHP ? `${opponent} (${oppoHP}HP)` : `${msg.author} (${userHP}HP)`} **Loser:** ${userHP > oppoHP ? `${opponent} (${oppoHP}HP)` : `${msg.author} (${userHP}HP)`}
`); `);
} catch (err) { } catch (err) {
this.fighting.delete(msg.guild.id); this.fighting.delete(msg.channel.id);
return msg.say(`Oh no, an Error occurred: \`${err.message}\`. Try again later!`); return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
} }
} }
}; };
+1
View File
@@ -5,6 +5,7 @@ module.exports = class FishyCommand extends Command {
constructor(client) { constructor(client) {
super(client, { super(client, {
name: 'fishy', name: 'fishy',
aliases: ['fish'],
group: 'games', group: 'games',
memberName: 'fishy', memberName: 'fishy',
description: 'Catches a fish.' description: 'Catches a fish.'
+7 -7
View File
@@ -27,16 +27,16 @@ module.exports = class GunfightCommand extends Command {
const { opponent } = args; const { opponent } = args;
if (opponent.bot) return msg.say('Bots may not be fought.'); 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 (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.'); if (this.fighting.has(msg.channel.id)) return msg.say('Only one fight may be occurring per channel.');
this.fighting.add(msg.guild.id); this.fighting.add(msg.channel.id);
try { 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, { const verify = await msg.channel.awaitMessages(res => res.author.id === opponent.id, {
max: 1, max: 1,
time: 30000 time: 30000
}); });
if (!verify.size || !['yes', 'y'].includes(verify.first().content.toLowerCase())) { 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...'); return msg.say('Looks like they declined...');
} }
await msg.say('Get Ready...'); await msg.say('Get Ready...');
@@ -49,12 +49,12 @@ module.exports = class GunfightCommand extends Command {
max: 1, max: 1,
time: 30000 time: 30000
}); });
this.fighting.delete(msg.guild.id); this.fighting.delete(msg.channel.id);
if (!winner.size) return msg.say('Oh... No one won.'); if (!winner.size) return msg.say('Oh... No one won.');
return msg.say(`And the winner is ${winner.first().author.username}!`); return msg.say(`And the winner is ${winner.first().author.username}!`);
} catch (err) { } catch (err) {
this.fighting.delete(msg.guild.id); this.fighting.delete(msg.channel.id);
return msg.say(`Oh no, an Error occurred: \`${err.message}\`. Try again later!`); return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
} }
} }
}; };
+9 -10
View File
@@ -17,8 +17,8 @@ module.exports = class HangmanCommand extends Command {
} }
async run(msg) { async run(msg) {
if (this.playing.has(msg.guild.id)) return msg.say('Only one game may be occurring per server.'); if (this.playing.has(msg.channel.id)) return msg.say('Only one game may be occurring per channel.');
this.playing.add(msg.guild.id); this.playing.add(msg.channel.id);
try { try {
const { body } = await snekfetch const { body } = await snekfetch
.get('http://api.wordnik.com:80/v4/words.json/randomWord') .get('http://api.wordnik.com:80/v4/words.json/randomWord')
@@ -32,7 +32,7 @@ module.exports = class HangmanCommand extends Command {
maxLength: -1, maxLength: -1,
api_key: WORDNIK_KEY api_key: WORDNIK_KEY
}); });
const word = body.word.toLowerCase().replace(/[ ]/g, '-'); const word = body.word.toLowerCase().replace(/ /g, '-');
let points = 0; let points = 0;
const confirmation = []; const confirmation = [];
const incorrect = []; const incorrect = [];
@@ -61,10 +61,9 @@ module.exports = class HangmanCommand extends Command {
} else if (word.includes(choice)) { } else if (word.includes(choice)) {
await msg.say('Nice job!'); await msg.say('Nice job!');
for (let i = 0; i < word.length; i++) { for (let i = 0; i < word.length; i++) {
if (word[i] === choice) { // eslint-disable-line max-depth if (word[i] !== choice) continue; // eslint-disable-line max-depth
confirmation.push(word[i]); confirmation.push(word[i]);
display[i] = word[i]; display[i] = word[i];
}
} }
} else { } else {
await msg.say('Nope!'); await msg.say('Nope!');
@@ -72,12 +71,12 @@ module.exports = class HangmanCommand extends Command {
points++; 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}!`); if (word.length === confirmation.length) return msg.say(`You won, it was ${word}!`);
return msg.say(`Too bad... It was ${word}...`); return msg.say(`Too bad... It was ${word}...`);
} catch (err) { } catch (err) {
this.playing.delete(msg.guild.id); this.playing.delete(msg.channel.id);
return msg.say(`Oh no, an Error occurred: \`${err.message}\`. Try again later!`); return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
} }
} }
}; };
+2 -2
View File
@@ -12,7 +12,7 @@ module.exports = class LotteryCommand extends Command {
run(msg) { run(msg) {
const lottery = Math.floor(Math.random() * 100) + 1; const lottery = Math.floor(Math.random() * 100) + 1;
if (lottery === 1) return msg.reply(`Wow! You actually won! Great job!`); if (lottery === 1) return msg.reply('Nice job! 10/10! You deserve some cake!');
return msg.reply(`Nope, sorry, you lost.`); return msg.reply('Nope, sorry, you lost.');
} }
}; };
+18 -3
View File
@@ -1,7 +1,22 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js'); const { MessageEmbed } = require('discord.js');
const math = require('mathjs'); 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 { module.exports = class MathGameCommand extends Command {
constructor(client) { constructor(client) {
@@ -14,11 +29,11 @@ module.exports = class MathGameCommand extends Command {
args: [ args: [
{ {
key: 'difficulty', 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', type: 'string',
validate: difficulty => { validate: difficulty => {
if (difficulties.includes(difficulty.toLowerCase())) return true; 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() parse: difficulty => difficulty.toLowerCase()
} }
+6 -5
View File
@@ -3,6 +3,7 @@ const { MessageEmbed } = require('discord.js');
const { stripIndents } = require('common-tags'); const { stripIndents } = require('common-tags');
const snekfetch = require('snekfetch'); const snekfetch = require('snekfetch');
const { shuffle, list } = require('../../structures/Util'); const { shuffle, list } = require('../../structures/Util');
const types = ['multiple', 'boolean'];
const difficulties = ['easy', 'medium', 'hard']; const difficulties = ['easy', 'medium', 'hard'];
module.exports = class QuizCommand extends Command { module.exports = class QuizCommand extends Command {
@@ -17,22 +18,22 @@ module.exports = class QuizCommand extends Command {
args: [ args: [
{ {
key: 'type', 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', type: 'string',
validate: type => { validate: type => {
if (['multiple', 'boolean'].includes(type.toLowerCase())) return true; if (types.includes(type.toLowerCase())) return true;
return 'Please enter either `multiple` or `boolean`.'; return `Invalid type, please enter either ${list(types, 'or')}.`;
}, },
parse: type => type.toLowerCase() parse: type => type.toLowerCase()
}, },
{ {
key: 'difficulty', 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', type: 'string',
default: '', default: '',
validate: difficulty => { validate: difficulty => {
if (difficulties.includes(difficulty.toLowerCase())) return true; 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() parse: difficulty => difficulty.toLowerCase()
} }
+15 -14
View File
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const choices = ['paper', 'rock', 'scissors']; const choices = ['rock', 'paper', 'scissors'];
module.exports = class RockPaperScissorsCommand extends Command { module.exports = class RockPaperScissorsCommand extends Command {
constructor(client) { 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 { choice } = args;
const response = choices[Math.floor(Math.random() * choices.length)]; const response = choices[Math.floor(Math.random() * choices.length)];
if (choice === 'rock') { if (choice === 'rock') {
if (response === 'rock') return msg.say('Rock! Aw... A tie...'); if (response === 'rock') return msg.say('Rock! Aw... A tie...');
else if (response === 'paper') return msg.say('Paper! Yes! I win!'); if (response === 'paper') return msg.say('Paper! Yes! I win!');
else if (response === 'scissors') return msg.say('Scissors! Aw... I lose...'); 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 (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.');
} }
}; };
+4 -5
View File
@@ -21,11 +21,10 @@ module.exports = class SlotsCommand extends Command {
${slotOne}|${slotTwo}|${slotThree} ${slotOne}|${slotTwo}|${slotThree}
Wow! You won! Great job... er... luck! 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?
`);
} }
}; };
+12 -3
View File
@@ -1,6 +1,15 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js'); 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 { module.exports = class TypingGameCommand extends Command {
constructor(client) { constructor(client) {
@@ -13,11 +22,11 @@ module.exports = class TypingGameCommand extends Command {
args: [ args: [
{ {
key: 'difficulty', 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', type: 'string',
validate: difficulty => { validate: difficulty => {
if (difficulties.includes(difficulty.toLowerCase())) return true; 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() parse: difficulty => difficulty.toLowerCase()
} }
+42
View File
@@ -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);
}
};
+1 -1
View File
@@ -16,7 +16,7 @@ module.exports = class RoleInfoCommand extends Command {
args: [ args: [
{ {
key: 'role', key: 'role',
prompt: 'Which role would you like to get info on?', prompt: 'Which role would you like to get information on?',
type: 'role' type: 'role'
} }
] ]
+2 -1
View File
@@ -1,7 +1,8 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js'); const { MessageEmbed } = require('discord.js');
const moment = require('moment'); 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 { module.exports = class GuildInfoCommand extends Command {
constructor(client) { constructor(client) {
+1 -1
View File
@@ -16,7 +16,7 @@ module.exports = class AchievementCommand extends Command {
type: 'string', type: 'string',
validate: text => { validate: text => {
if (text.length < 25) return true; if (text.length < 25) return true;
return 'Text must be under 25 characters.'; return 'Please keep the text under 25 characters.';
} }
} }
] ]
+6 -5
View File
@@ -1,4 +1,5 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const { list } = require('../../structures/Util');
const codes = require('../../assets/json/meme'); const codes = require('../../assets/json/meme');
module.exports = class MemeCommand extends Command { module.exports = class MemeCommand extends Command {
@@ -7,17 +8,17 @@ module.exports = class MemeCommand extends Command {
name: 'meme', name: 'meme',
group: 'image-edit', group: 'image-edit',
memberName: 'meme', 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'], clientPermissions: ['ATTACH_FILES'],
details: `**Codes:** ${codes.join(', ')}`, details: `**Codes:** ${codes.join(', ')}`,
args: [ args: [
{ {
key: 'type', 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', type: 'string',
validate: type => { 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.'; return `Invalid meme type, please enter either ${list(codes, 'or')}.`;
}, },
parse: type => type.toLowerCase() parse: type => type.toLowerCase()
}, },
@@ -29,7 +30,7 @@ module.exports = class MemeCommand extends Command {
if (top.length < 200) return true; if (top.length < 200) return true;
return 'Please keep the top text under 200 characters.'; return 'Please keep the top text under 200 characters.';
}, },
parse: top => encodeURIComponent(top.replace(/[ ]/g, '-')) parse: top => encodeURIComponent(top.replace(/ /g, '-'))
}, },
{ {
key: 'bottom', key: 'bottom',
@@ -39,7 +40,7 @@ module.exports = class MemeCommand extends Command {
if (bottom.length < 200) return true; if (bottom.length < 200) return true;
return 'Please keep the bottom text under 200 characters.'; return 'Please keep the bottom text under 200 characters.';
}, },
parse: bottom => encodeURIComponent(bottom.replace(/[ ]/g, '-')) parse: bottom => encodeURIComponent(bottom.replace(/ /g, '-'))
} }
] ]
}); });
+13 -13
View File
@@ -5,37 +5,37 @@ module.exports = class PokemonFusionCommand extends Command {
constructor(client) { constructor(client) {
super(client, { super(client, {
name: 'pokemon-fusion', name: 'pokemon-fusion',
aliases: ['poke-fusion', 'poke-fuse'], aliases: ['poke-fusion', 'poke-fuse', 'pokémon-fusion', 'poké-fusion', 'poké-fuse'],
group: 'image-edit', group: 'image-edit',
memberName: 'pokemon-fusion', memberName: 'pokemon-fusion',
description: 'Fuses two Generation I Pokémon together.', description: 'Fuses two Generation I Pokémon together.',
args: [ args: [
{ {
key: 'source1', key: 'body',
prompt: 'What Pokémon should be fused?', prompt: 'What Pokémon should be fused?',
type: 'string', type: 'string',
validate: source1 => { validate: body => {
if (pokemon[source1.toLowerCase()]) return true; if (pokemon[body.toLowerCase()]) return true;
return 'Only Pokémon from Generation I may be used.'; 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?', prompt: 'What Pokémon should be fused?',
type: 'string', type: 'string',
validate: source2 => { validate: palette => {
if (pokemon[source2.toLowerCase()]) return true; if (pokemon[palette.toLowerCase()]) return true;
return 'Only Pokémon from Generation I may be used.'; 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) { run(msg, args) {
const { source1, source2 } = args; const { body, palette } = args;
return msg.say(`http://images.alexonsager.net/pokemon/fused/${source1}/${source1}.${source2}.png`); return msg.say(`http://images.alexonsager.net/pokemon/fused/${body}/${palette}.${body}.png`);
} }
}; };
+1 -1
View File
@@ -26,7 +26,7 @@ module.exports = class BanCommand extends Command {
type: 'string', type: 'string',
validate: reason => { validate: reason => {
if (reason.length < 140) return true; if (reason.length < 140) return true;
return 'Reason must be under 140 characters.'; return 'Please keep the reason under 140 characters.';
} }
} }
] ]
+2 -2
View File
@@ -26,7 +26,7 @@ module.exports = class HackbanCommand extends Command {
type: 'string', type: 'string',
validate: reason => { validate: reason => {
if (reason.length < 140) return true; 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?'); if (id === msg.guild.ownerID) return msg.say('Don\'t you think that might be betraying your leader?');
let user; let user;
try { try {
user = await this.client.fetchUser(id); user = await this.client.users.fetch(id);
} catch (err) { } catch (err) {
return msg.say('Could not resolve user.'); return msg.say('Could not resolve user.');
} }
+1 -1
View File
@@ -26,7 +26,7 @@ module.exports = class KickCommand extends Command {
type: 'string', type: 'string',
validate: reason => { validate: reason => {
if (reason.length < 140) return true; if (reason.length < 140) return true;
return 'Reason must be under 140 characters.'; return 'Please keep the reason under 140 characters.';
} }
} }
] ]
+30 -13
View File
@@ -1,5 +1,6 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const { stripIndents } = require('common-tags'); const { stripIndents } = require('common-tags');
const { wait } = require('../../structures/Util');
module.exports = class LockdownCommand extends Command { module.exports = class LockdownCommand extends Command {
constructor(client) { constructor(client) {
@@ -13,31 +14,47 @@ module.exports = class LockdownCommand extends Command {
userPermissions: ['ADMINISTRATOR'], userPermissions: ['ADMINISTRATOR'],
args: [ args: [
{ {
key: 'type', key: 'action',
prompt: 'Please enter either start or stop.', prompt: 'What action should be performed? Either start or stop.',
type: 'string', type: 'string',
default: 'start', default: 'start',
validate: type => { validate: action => {
if (['start', 'stop'].includes(type.toLowerCase())) return true; if (['start', 'stop'].includes(action.toLowerCase())) return true;
return 'Please enter either start or stop.'; 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 async run(msg, args) { // eslint-disable-line consistent-return
const { type } = args; const { action, time } = args;
if (type === 'start') { if (action === 'start') {
await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: false }); await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: false });
return msg.say(stripIndents` await msg.say(stripIndents`
Lockdown Started, users without Administrator can no longer post messages. Lockdown started, users without overwrites can no longer post messages.
Please use \`lockdown stop\` to end the lockdown. ${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 }); 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.');
} }
} }
}; };
+1 -1
View File
@@ -32,7 +32,7 @@ module.exports = class PruneCommand extends Command {
async run(msg, args) { async run(msg, args) {
const { count } = args; const { count } = args;
try { 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); await msg.channel.bulkDelete(messages, true);
return null; return null;
} catch (err) { } catch (err) {
+1 -1
View File
@@ -26,7 +26,7 @@ module.exports = class SoftbanCommand extends Command {
type: 'string', type: 'string',
validate: reason => { validate: reason => {
if (reason.length < 140) return true; if (reason.length < 140) return true;
return 'Reason must be under 140 characters.'; return 'Please keep the reason under 140 characters.';
} }
} }
] ]
+1 -1
View File
@@ -26,7 +26,7 @@ module.exports = class UnbanCommand extends Command {
type: 'string', type: 'string',
validate: reason => { validate: reason => {
if (reason.length < 140) return true; if (reason.length < 140) return true;
return 'Reason must be under 140 characters.'; return 'Please keep the reason under 140 characters.';
} }
} }
] ]
+1 -1
View File
@@ -25,7 +25,7 @@ module.exports = class WarnCommand extends Command {
type: 'string', type: 'string',
validate: reason => { validate: reason => {
if (reason.length < 140) return true; if (reason.length < 140) return true;
return 'Invalid Reason. Reason must be under 140 characters.'; return 'Please keep the reason under 140 characters.';
} }
} }
] ]
+11 -10
View File
@@ -1,5 +1,6 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const snekfetch = require('snekfetch'); const snekfetch = require('snekfetch');
const { list } = require('../../structures/Util');
const codes = require('../../assets/json/currency'); const codes = require('../../assets/json/currency');
module.exports = class CurrencyCommand extends Command { module.exports = class CurrencyCommand extends Command {
@@ -17,19 +18,19 @@ module.exports = class CurrencyCommand extends Command {
type: 'string', type: 'string',
validate: base => { 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.'; return `Invalid base, please enter either ${list(codes, 'or')}.`;
}, },
parse: base => base.toUpperCase() parse: base => base.toUpperCase()
}, },
{ {
key: 'to', key: 'target',
prompt: 'What currency code do you want to convert to?', prompt: 'What currency code do you want to convert to?',
type: 'string', type: 'string',
validate: to => { validate: target => {
if (codes.includes(to.toUpperCase())) return true; if (codes.includes(target.toUpperCase())) return true;
return 'Invalid Currency Code. Use `help currency` to view a list of currency codes.'; return `Invalid target, please enter either ${list(codes, 'or')}.`;
}, },
parse: to => to.toUpperCase() parse: target => target.toUpperCase()
}, },
{ {
key: 'amount', key: 'amount',
@@ -41,14 +42,14 @@ module.exports = class CurrencyCommand extends Command {
} }
async run(msg, args) { async run(msg, args) {
const { base, to, amount } = args; const { base, target, amount } = args;
if (base === to) return msg.say(`Converting ${base} to ${to} is the same value, dummy.`); if (base === target) return msg.say(`Converting ${base} to ${target} is the same value, dummy.`);
const { body } = await snekfetch const { body } = await snekfetch
.get('http://api.fixer.io/latest') .get('http://api.fixer.io/latest')
.query({ .query({
base, 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}.`);
} }
}; };
+23 -20
View File
@@ -1,4 +1,6 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const { list } = require('../../structures/Util');
const units = ['celsius', 'fahrenheit', 'kelvin'];
module.exports = class TemperatureCommand extends Command { module.exports = class TemperatureCommand extends Command {
constructor(client) { constructor(client) {
@@ -6,27 +8,27 @@ module.exports = class TemperatureCommand extends Command {
name: 'temperature', name: 'temperature',
group: 'num-edit', group: 'num-edit',
memberName: 'temperature', memberName: 'temperature',
description: 'Converts temperatures to/from Celsius, Fahrenheit, or Kelvin.', description: `Converts temperatures to/from ${list(units, 'or')}.`,
args: [ args: [
{ {
key: 'base', key: 'base',
prompt: 'What temperature unit do you want to use as the base?', prompt: 'What temperature unit do you want to use as the base?',
type: 'string', type: 'string',
validate: base => { validate: base => {
if (['celsius', 'fahrenheit', 'kelvin'].includes(base.toLowerCase())) return true; if (units.includes(base.toLowerCase())) return true;
return 'Please enter either celsius, fahrenheit, or kelvin.'; return `Invalid base, please enter either ${list(units, 'or')}.`;
}, },
parse: base => base.toLowerCase() parse: base => base.toLowerCase()
}, },
{ {
key: 'to', key: 'target',
prompt: 'What temperature unit do you want to convert to?', prompt: 'What temperature unit do you want to convert to?',
type: 'string', type: 'string',
validate: to => { validate: target => {
if (['celsius', 'fahrenheit', 'kelvin'].includes(to.toLowerCase())) return true; if (units.includes(target.toLowerCase())) return true;
return 'Please enter either celsius, fahrenheit, or kelvin.'; return `Invalid target, please enter either ${list(units, 'or')}.`;
}, },
parse: to => to.toLowerCase() parse: target => target.toLowerCase()
}, },
{ {
key: 'amount', key: 'amount',
@@ -38,18 +40,19 @@ module.exports = class TemperatureCommand extends Command {
} }
run(msg, args) { // eslint-disable-line consistent-return run(msg, args) { // eslint-disable-line consistent-return
const { base, to, amount } = args; const { base, target, amount } = args;
if (base === to) { if (base === target) return msg.say(`Converting ${base} to ${target} is the same value, dummy.`);
return msg.say(`Converting ${base} to ${to} is the same value, dummy.`); if (base === 'celsius') {
} else if (base === 'celsius') { if (target === 'fahrenheit') return msg.say(`${amount}°C is ${(amount * 1.8) + 32}°F.`);
if (to === '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.`);
else if (to === 'kelvin') return msg.say(`${amount}°C is ${amount + 273.15}°K.`); }
} else if (base === 'fahrenheit') { if (base === 'fahrenheit') {
if (to === 'celsius') return msg.say(`${amount}°F is ${(amount - 32) / 1.8}°C.`); if (target === '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.`); if (target === '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 (base === 'kelvin') {
else if (to === 'fahrenheit') return msg.say(`${amount}°K is ${(amount * 1.8) - 459.67}°F.`); 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.`);
} }
} }
}; };
+1 -1
View File
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const { stripIndents } = require('common-tags'); 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 { module.exports = class MagicConchCommand extends Command {
constructor(client) { constructor(client) {
+5 -3
View File
@@ -1,5 +1,7 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const snekfetch = require('snekfetch'); const snekfetch = require('snekfetch');
const { list } = require('../../structures/Util');
const genders = ['male', 'female', 'both'];
module.exports = class NameCommand extends Command { module.exports = class NameCommand extends Command {
constructor(client) { constructor(client) {
@@ -11,12 +13,12 @@ module.exports = class NameCommand extends Command {
args: [ args: [
{ {
key: 'gender', 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', type: 'string',
default: 'both', default: 'both',
validate: gender => { validate: gender => {
if (['male', 'female', 'both'].includes(gender.toLowerCase())) return true; if (genders.includes(gender.toLowerCase())) return true;
return 'Please enter either male, female, or both.'; return `Invalid gender, please enter either ${list(genders, 'or')}.`;
}, },
parse: gender => gender.toLowerCase() parse: gender => gender.toLowerCase()
} }
+1 -1
View File
@@ -38,7 +38,7 @@ module.exports = class TodayCommand extends Command {
.setDescription(`${event.year}: ${event.text}`); .setDescription(`${event.year}: ${event.text}`);
return msg.embed(embed); return msg.embed(embed);
} catch (err) { } 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; throw err;
} }
} }
+3 -2
View File
@@ -1,6 +1,7 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js'); const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch'); const snekfetch = require('snekfetch');
const { list } = require('../../structures/Util');
const signs = require('../../assets/json/horoscope'); const signs = require('../../assets/json/horoscope');
module.exports = class HoroscopeCommand extends Command { module.exports = class HoroscopeCommand extends Command {
@@ -15,11 +16,11 @@ module.exports = class HoroscopeCommand extends Command {
args: [ args: [
{ {
key: 'sign', 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', type: 'string',
validate: sign => { validate: sign => {
if (signs.includes(sign.toLowerCase())) return true; 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() parse: sign => sign.toLowerCase()
} }
+6 -6
View File
@@ -1,6 +1,7 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const sounds = require('../../assets/json/soundboard'); const { list } = require('../../structures/Util');
const path = require('path'); const path = require('path');
const sounds = ['airhorn', 'cat', 'dun-dun-dun', 'pikachu', 'space'];
module.exports = class SoundboardCommand extends Command { module.exports = class SoundboardCommand extends Command {
constructor(client) { constructor(client) {
@@ -20,14 +21,13 @@ module.exports = class SoundboardCommand extends Command {
args: [ args: [
{ {
key: 'sound', key: 'sound',
prompt: 'What sound would you like to play?', prompt: `What sound would you like to play? Either ${list(sounds, 'or')}.`,
type: 'string', type: 'string',
default: sounds[Math.floor(Math.random() * sounds.length)],
validate: sound => { validate: sound => {
if (sounds.includes(sound.toLowerCase())) return true; 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.'); if (this.client.voiceConnections.has(channel.guild.id)) return msg.say('I am already playing a sound.');
const connection = await channel.join(); const connection = await channel.join();
await msg.react('🔊'); 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', () => { dispatcher.once('end', () => {
channel.leave(); channel.leave();
msg.react('✅'); msg.react('✅');
+6 -5
View File
@@ -6,6 +6,7 @@ module.exports = class StrawpollCommand extends Command {
constructor(client) { constructor(client) {
super(client, { super(client, {
name: 'strawpoll', name: 'strawpoll',
aliases: ['poll'],
group: 'random', group: 'random',
memberName: 'strawpoll', memberName: 'strawpoll',
description: 'Creates a Strawpoll from the options you provide.', description: 'Creates a Strawpoll from the options you provide.',
@@ -16,7 +17,7 @@ module.exports = class StrawpollCommand extends Command {
type: 'string', type: 'string',
validate: title => { validate: title => {
if (title.length < 200) return true; 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, infinite: true,
validate: choice => { validate: choice => {
if (choice.length < 140) return true; 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) { async run(msg, args) {
const { title, options } = args; const { title, options } = args;
if (options.length < 2) return msg.say('You provided less than two choices.'); if (options.length < 2) return msg.say('Please provide more than one choice.');
if (options.length > 31) return msg.say('You provided more than thirty choices.'); if (options.length > 31) return msg.say('Please provide thirty or less choices.');
const { body } = await snekfetch const { body } = await snekfetch
.post('https://strawpoll.me/api/v2/polls') .post('https://strawpoll.me/api/v2/polls')
.send({ title, options }); .send({ title, options });
return msg.say(stripIndents` return msg.say(stripIndents`
${body.title} ${body.title}
http://strawpoll.me/${body.id} http://www.strawpoll.me/${body.id}
`); `);
} }
}; };
+13 -13
View File
@@ -35,7 +35,8 @@ module.exports = class XKCDCommand extends Command {
.setImage(current.body.img) .setImage(current.body.img)
.setFooter(current.body.alt); .setFooter(current.body.alt);
return msg.embed(embed); return msg.embed(embed);
} else if (type === 'random') { }
if (type === 'random') {
const random = Math.floor(Math.random() * current.body.num) + 1; const random = Math.floor(Math.random() * current.body.num) + 1;
const { body } = await snekfetch const { body } = await snekfetch
.get(`https://xkcd.com/${random}/info.0.json`); .get(`https://xkcd.com/${random}/info.0.json`);
@@ -46,18 +47,17 @@ module.exports = class XKCDCommand extends Command {
.setImage(body.img) .setImage(body.img)
.setFooter(body.alt); .setFooter(body.alt);
return msg.embed(embed); 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);
} }
}; };
+1 -1
View File
@@ -49,7 +49,7 @@ module.exports = class AnimeCommand extends Command {
anime.entry[0].end_date[0], true); anime.entry[0].end_date[0], true);
return msg.embed(embed); return msg.embed(embed);
} catch (err) { } 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; throw err;
} }
} }
+3 -3
View File
@@ -9,12 +9,12 @@ module.exports = class BotSearchCommand extends Command {
name: 'bot-info', name: 'bot-info',
group: 'search', group: 'search',
memberName: 'bot-info', memberName: 'bot-info',
description: 'Searches Discord Bots for info on a bot.', description: 'Searches Discord Bots for information on a bot.',
clientPermissions: ['EMBED_LINKS'], clientPermissions: ['EMBED_LINKS'],
args: [ args: [
{ {
key: 'bot', key: 'bot',
prompt: 'Which bot do you want to get information for?', prompt: 'Which bot do you want to get information on?',
type: 'user' type: 'user'
} }
] ]
@@ -41,7 +41,7 @@ module.exports = class BotSearchCommand extends Command {
body.prefix, true); body.prefix, true);
return msg.embed(embed); return msg.embed(embed);
} catch (err) { } 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; throw err;
} }
} }
+2 -2
View File
@@ -15,7 +15,7 @@ module.exports = class BulbapediaCommand extends Command {
args: [ args: [
{ {
key: 'query', key: 'query',
prompt: 'What would you like to search for?', prompt: 'What article would you like to search for?',
type: 'string' type: 'string'
} }
] ]
@@ -36,7 +36,7 @@ module.exports = class BulbapediaCommand extends Command {
redirects: '', redirects: '',
formatversion: 2 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() const embed = new MessageEmbed()
.setColor(0x3E7614) .setColor(0x3E7614)
.setTitle(body.query.pages[0].title) .setTitle(body.query.pages[0].title)
+1 -1
View File
@@ -32,7 +32,7 @@ module.exports = class DefineCommand extends Command {
useCanonical: false, useCanonical: false,
api_key: WORDNIK_KEY 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() const embed = new MessageEmbed()
.setColor(0x9797FF) .setColor(0x9797FF)
.setTitle(body[0].word) .setTitle(body[0].word)
+1 -1
View File
@@ -29,7 +29,7 @@ module.exports = class DiscrimCommand extends Command {
const discrim = args.discrim || msg.author.discriminator; const discrim = args.discrim || msg.author.discriminator;
const users = this.client.users.filter(user => user.discriminator === discrim).map(user => user.username); const users = this.client.users.filter(user => user.discriminator === discrim).map(user => user.username);
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setTitle(`${users.length} Users with the discriminator: ${discrim}`) .setTitle(`${users.length} Users with the discriminator #${discrim}`)
.setColor(0x9797FF) .setColor(0x9797FF)
.setDescription(users.join(', ')); .setDescription(users.join(', '));
return msg.embed(embed); return msg.embed(embed);
+1 -1
View File
@@ -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 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' 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 forecasts = body.query.results.channel.item.forecast;
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setColor(0x0000FF) .setColor(0x0000FF)
+1 -1
View File
@@ -12,7 +12,7 @@ module.exports = class GiphyCommand extends Command {
args: [ args: [
{ {
key: 'query', key: 'query',
prompt: 'What would you like to search for?', prompt: 'What GIF would you like to search for?',
type: 'string' type: 'string'
} }
] ]
+4 -4
View File
@@ -10,7 +10,7 @@ module.exports = class GitHubCommand extends Command {
name: 'github', name: 'github',
group: 'search', group: 'search',
memberName: 'github', memberName: 'github',
description: 'Searches GitHub for info on a GitHub repository.', description: 'Searches GitHub for information on a repository.',
clientPermissions: ['EMBED_LINKS'], clientPermissions: ['EMBED_LINKS'],
args: [ args: [
{ {
@@ -20,7 +20,7 @@ module.exports = class GitHubCommand extends Command {
}, },
{ {
key: 'repository', 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' type: 'string'
} }
] ]
@@ -37,7 +37,7 @@ module.exports = class GitHubCommand extends Command {
.setAuthor('GitHub', 'https://i.imgur.com/bRROLzk.png') .setAuthor('GitHub', 'https://i.imgur.com/bRROLzk.png')
.setTitle(body.full_name) .setTitle(body.full_name)
.setURL(body.html_url) .setURL(body.html_url)
.setDescription(body.description || 'No Description.') .setDescription(body.description || 'No description.')
.setThumbnail(body.owner.avatar_url || null) .setThumbnail(body.owner.avatar_url || null)
.addField(' Stars', .addField(' Stars',
body.stargazers_count, true) body.stargazers_count, true)
@@ -53,7 +53,7 @@ module.exports = class GitHubCommand extends Command {
moment(body.updated_at).format('MMMM Do YYYY'), true); moment(body.updated_at).format('MMMM Do YYYY'), true);
return msg.embed(embed); return msg.embed(embed);
} catch (err) { } 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; throw err;
} }
} }
+1 -1
View File
@@ -49,7 +49,7 @@ module.exports = class MangaCommand extends Command {
manga.entry[0].end_date[0], true); manga.entry[0].end_date[0], true);
return msg.embed(embed); return msg.embed(embed);
} catch (err) { } 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; throw err;
} }
} }
+3 -3
View File
@@ -14,16 +14,16 @@ module.exports = class MapCommand extends Command {
{ {
key: 'zoom', key: 'zoom',
label: 'zoom level', 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', type: 'integer',
validate: zoom => { validate: zoom => {
if (zoom < 21 && zoom > 0) return true; 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', 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' type: 'string'
} }
] ]
+2 -2
View File
@@ -16,7 +16,7 @@ module.exports = class MovieCommand extends Command {
args: [ args: [
{ {
key: 'query', key: 'query',
prompt: 'What would you like to search for?', prompt: 'What movie would you like to search for?',
type: 'string' type: 'string'
} }
] ]
@@ -32,7 +32,7 @@ module.exports = class MovieCommand extends Command {
include_adult: msg.channel.nsfw || false, include_adult: msg.channel.nsfw || false,
query 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 const { body } = await snekfetch
.get(`https://api.themoviedb.org/3/movie/${search.body.results[0].id}`) .get(`https://api.themoviedb.org/3/movie/${search.body.results[0].id}`)
.query({ api_key: TMDB_KEY }); .query({ api_key: TMDB_KEY });
+2 -2
View File
@@ -11,7 +11,7 @@ module.exports = class NeopetCommand extends Command {
args: [ args: [
{ {
key: 'query', 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' type: 'string'
} }
] ]
@@ -28,7 +28,7 @@ module.exports = class NeopetCommand extends Command {
mood: 1 mood: 1
}); });
const link = text.match(/http:\/\/pets\.neopets\.com\/cp\/.+\.png/); 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]); return msg.say(link[0]);
} }
}; };
+2 -2
View File
@@ -15,7 +15,7 @@ module.exports = class NPMCommand extends Command {
args: [ args: [
{ {
key: 'query', key: 'query',
prompt: 'What package do you want to get information for?', prompt: 'What package would you like to search for?',
type: 'string' type: 'string'
} }
] ]
@@ -51,7 +51,7 @@ module.exports = class NPMCommand extends Command {
body.maintainers.map(user => user.name).join(', ')); body.maintainers.map(user => user.name).join(', '));
return msg.embed(embed); return msg.embed(embed);
} catch (err) { } 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; throw err;
} }
} }
+11 -11
View File
@@ -14,7 +14,7 @@ module.exports = class OsuCommand extends Command {
args: [ args: [
{ {
key: 'query', key: 'query',
prompt: 'What osu username would you like to search for?', prompt: 'What user would you like to get information on?',
type: 'string' type: 'string'
} }
] ]
@@ -30,7 +30,7 @@ module.exports = class OsuCommand extends Command {
u: query, u: query,
type: 'string' 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() const embed = new MessageEmbed()
.setColor(0xFF66AA) .setColor(0xFF66AA)
.setAuthor('osu!', 'https://i.imgur.com/EmnUp00.png') .setAuthor('osu!', 'https://i.imgur.com/EmnUp00.png')
@@ -40,25 +40,25 @@ module.exports = class OsuCommand extends Command {
.addField(' ID', .addField(' ID',
body[0].user_id, true) body[0].user_id, true)
.addField(' Level', .addField(' Level',
body[0].level, true) body[0].level || 'N/A', true)
.addField(' Accuracy', .addField(' Accuracy',
body[0].accuracy, true) body[0].accuracy || 'N/A', true)
.addField(' Rank', .addField(' Rank',
body[0].pp_rank, true) body[0].pp_rank || 'N/A', true)
.addField(' Play Count', .addField(' Play Count',
body[0].playcount, true) body[0].playcount || 'N/A', true)
.addField(' Country', .addField(' Country',
body[0].country || 'N/A', true) body[0].country || 'N/A', true)
.addField(' Ranked Score', .addField(' Ranked Score',
body[0].ranked_score, true) body[0].ranked_score || 'N/A', true)
.addField(' Total Score', .addField(' Total Score',
body[0].total_score, true) body[0].total_score || 'N/A', true)
.addField(' SS', .addField(' SS',
body[0].count_rank_ss, true) body[0].count_rank_ss || 'N/A', true)
.addField(' S', .addField(' S',
body[0].count_rank_s, true) body[0].count_rank_s || 'N/A', true)
.addField(' A', .addField(' A',
body[0].count_rank_a, true); body[0].count_rank_a || 'N/A', true);
return msg.embed(embed); return msg.embed(embed);
} }
}; };
+3 -3
View File
@@ -16,9 +16,9 @@ module.exports = class PokedexCommand extends Command {
args: [ args: [
{ {
key: 'pokemon', 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', 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`); .setThumbnail(`https://www.serebii.net/sunmoon/pokemon/${id}.png`);
return msg.embed(embed); return msg.embed(embed);
} catch (err) { } 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; throw err;
} }
} }
+3 -3
View File
@@ -13,7 +13,7 @@ module.exports = class RecipeCommand extends Command {
args: [ args: [
{ {
key: 'query', key: 'query',
prompt: 'What would you like to search for?', prompt: 'What recipe would you like to search for?',
type: 'string' type: 'string'
} }
] ]
@@ -27,7 +27,7 @@ module.exports = class RecipeCommand extends Command {
.get('http://www.recipepuppy.com/api/') .get('http://www.recipepuppy.com/api/')
.query({ q: query }); .query({ q: query });
const body = JSON.parse(text); 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 recipe = body.results[Math.floor(Math.random() * body.results.length)];
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setColor(0xC20000) .setColor(0xC20000)
@@ -37,7 +37,7 @@ module.exports = class RecipeCommand extends Command {
.setThumbnail(recipe.thumbnail); .setThumbnail(recipe.thumbnail);
return msg.embed(embed); return msg.embed(embed);
} catch (err) { } catch (err) {
return msg.say('No Results.'); return msg.say('Could not find any results.');
} }
} }
}; };
+5 -5
View File
@@ -13,7 +13,7 @@ module.exports = class RedditCommand extends Command {
args: [ args: [
{ {
key: 'subreddit', 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' type: 'string'
} }
] ]
@@ -26,10 +26,10 @@ module.exports = class RedditCommand extends Command {
const { body } = await snekfetch const { body } = await snekfetch
.get(`https://www.reddit.com/r/${subreddit}/new.json`) .get(`https://www.reddit.com/r/${subreddit}/new.json`)
.query({ sort: 'new' }); .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)]; 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 (!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() const embed = new MessageEmbed()
.setColor(0xFF4500) .setColor(0xFF4500)
.setAuthor('Reddit', 'https://i.imgur.com/V6hXniU.png') .setAuthor('Reddit', 'https://i.imgur.com/V6hXniU.png')
@@ -45,8 +45,8 @@ module.exports = class RedditCommand extends Command {
post.data.score, true); post.data.score, true);
return msg.embed(embed); return msg.embed(embed);
} catch (err) { } catch (err) {
if (err.status === 403) return msg.say('This Subreddit is Private.'); if (err.status === 403) return msg.say('This subreddit is private.');
if (err.status === 404) return msg.say('Subreddit Not Found.'); if (err.status === 404) return msg.say('Could not find the subreddit.');
throw err; throw err;
} }
} }
+1 -1
View File
@@ -14,7 +14,7 @@ module.exports = class SoundCloudCommand extends Command {
args: [ args: [
{ {
key: 'query', key: 'query',
prompt: 'What do you want to search SoundCloud for?', prompt: 'What song would you like to search for?',
type: 'string' type: 'string'
} }
] ]
+1 -1
View File
@@ -29,7 +29,7 @@ module.exports = class SteamCommand extends Command {
l: 'en', l: 'en',
term: query 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 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 original = body.items[0].price ? body.items[0].price.initial / 100 : 0.00;
const price = current === original ? `$${current}` : `~~$${original}~~ $${current}`; const price = current === original ? `$${current}` : `~~$${original}~~ $${current}`;
+2 -2
View File
@@ -16,7 +16,7 @@ module.exports = class TVShowCommand extends Command {
args: [ args: [
{ {
key: 'query', key: 'query',
prompt: 'What would you like to search for?', prompt: 'What TV show would you like to search for?',
type: 'string' type: 'string'
} }
] ]
@@ -32,7 +32,7 @@ module.exports = class TVShowCommand extends Command {
include_adult: msg.channel.nsfw || false, include_adult: msg.channel.nsfw || false,
query 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 const { body } = await snekfetch
.get(`https://api.themoviedb.org/3/tv/${search.body.results[0].id}`) .get(`https://api.themoviedb.org/3/tv/${search.body.results[0].id}`)
.query({ api_key: TMDB_KEY }); .query({ api_key: TMDB_KEY });
+1 -1
View File
@@ -26,7 +26,7 @@ module.exports = class UrbanCommand extends Command {
const { body } = await snekfetch const { body } = await snekfetch
.get('http://api.urbandictionary.com/v0/define') .get('http://api.urbandictionary.com/v0/define')
.query({ term: query }); .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() const embed = new MessageEmbed()
.setColor(0x32A8F0) .setColor(0x32A8F0)
.setAuthor('Urban Dictionary', 'https://i.imgur.com/fzFuuL7.png') .setAuthor('Urban Dictionary', 'https://i.imgur.com/fzFuuL7.png')
+1 -1
View File
@@ -35,7 +35,7 @@ module.exports = class VocaloidCommand extends Command {
nameMatchMode: 'Words', nameMatchMode: 'Words',
fields: 'ThumbUrl,Lyrics' 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() const embed = new MessageEmbed()
.setColor(0x86D2D0) .setColor(0x86D2D0)
.setAuthor('VocaDB', 'https://i.imgur.com/9Tx9UIc.jpg') .setAuthor('VocaDB', 'https://i.imgur.com/9Tx9UIc.jpg')
+1 -1
View File
@@ -32,7 +32,7 @@ module.exports = class WattpadCommand extends Command {
limit: 1 limit: 1
}) })
.set({ Authorization: `Basic ${WATTPAD_KEY}` }); .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() const embed = new MessageEmbed()
.setColor(0xF89C34) .setColor(0xF89C34)
.setAuthor('Wattpad', 'https://i.imgur.com/Rw9vRQB.png') .setAuthor('Wattpad', 'https://i.imgur.com/Rw9vRQB.png')
+2 -2
View File
@@ -13,7 +13,7 @@ module.exports = class WeatherCommand extends Command {
args: [ args: [
{ {
key: 'query', 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' 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 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' 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() const embed = new MessageEmbed()
.setColor(0x0000FF) .setColor(0x0000FF)
.setAuthor(body.query.results.channel.title, 'https://i.imgur.com/2MT0ViC.png') .setAuthor(body.query.results.channel.title, 'https://i.imgur.com/2MT0ViC.png')
+3 -3
View File
@@ -15,12 +15,12 @@ module.exports = class WikiaCommand extends Command {
args: [ args: [
{ {
key: 'wiki', 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' type: 'string'
}, },
{ {
key: 'query', key: 'query',
prompt: 'What would you like to search for?', prompt: 'What article would you like to search for?',
type: 'string' 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); .setThumbnail(body.sections[0].images.length ? body.sections[0].images[0].src : null);
return msg.embed(embed); return msg.embed(embed);
} catch (err) { } catch (err) {
return msg.say('No Results or Invalid Wiki.'); return msg.say('Could not find any results.');
} }
} }
}; };
+2 -2
View File
@@ -14,7 +14,7 @@ module.exports = class WikipediaCommand extends Command {
args: [ args: [
{ {
key: 'query', key: 'query',
prompt: 'What would you like to search for?', prompt: 'What article would you like to search for?',
type: 'string' type: 'string'
} }
] ]
@@ -35,7 +35,7 @@ module.exports = class WikipediaCommand extends Command {
redirects: '', redirects: '',
formatversion: 2 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() const embed = new MessageEmbed()
.setColor(0xE7E7E7) .setColor(0xE7E7E7)
.setTitle(body.query.pages[0].title) .setTitle(body.query.pages[0].title)
+2 -2
View File
@@ -14,7 +14,7 @@ module.exports = class YouTubeCommand extends Command {
args: [ args: [
{ {
key: 'query', key: 'query',
prompt: 'What would you like to search for?', prompt: 'What video would you like to search for?',
type: 'string' type: 'string'
} }
] ]
@@ -32,7 +32,7 @@ module.exports = class YouTubeCommand extends Command {
q: query, q: query,
key: GOOGLE_KEY 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() const embed = new MessageEmbed()
.setColor(0xDD2825) .setColor(0xDD2825)
.setTitle(body.items[0].snippet.title) .setTitle(body.items[0].snippet.title)
+2 -2
View File
@@ -13,7 +13,7 @@ module.exports = class YuGiOhCommand extends Command {
args: [ args: [
{ {
key: 'query', key: 'query',
prompt: 'What card would you like to get data for?', prompt: 'What card would you like to get information on?',
type: 'string', type: 'string',
parse: text => encodeURIComponent(text) parse: text => encodeURIComponent(text)
} }
@@ -25,7 +25,7 @@ module.exports = class YuGiOhCommand extends Command {
const { query } = args; const { query } = args;
const { body } = await snekfetch const { body } = await snekfetch
.get(`http://yugiohprices.com/api/card_data/${query}`); .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() const embed = new MessageEmbed()
.setColor(0xBE5F1F) .setColor(0xBE5F1F)
.setTitle(body.data.name) .setTitle(body.data.name)
+4 -7
View File
@@ -27,12 +27,9 @@ module.exports = class BinaryCommand extends Command {
} }
binary(text) { binary(text) {
return unescape(encodeURIComponent(text)) return text.split('').map(str => {
.split('') const converted = str.charCodeAt(0).toString(2);
.map(str => { return `${'00000000'.slice(converted.length)}${converted}`;
const converted = str.charCodeAt(0).toString(2); }).join('');
return `${'00000000'.slice(converted.length)}${converted}`;
})
.join('');
} }
}; };
+1 -1
View File
@@ -7,7 +7,7 @@ module.exports = class CowsayCommand extends Command {
name: 'cow-say', name: 'cow-say',
group: 'text-edit', group: 'text-edit',
memberName: 'cow-say', memberName: 'cow-say',
description: 'Converts text to cowsay.', description: 'Converts text to cow-say.',
args: [ args: [
{ {
key: 'text', key: 'text',
+2 -3
View File
@@ -8,7 +8,6 @@ module.exports = class SayCommand extends Command {
group: 'text-edit', group: 'text-edit',
memberName: 'say', memberName: 'say',
description: 'Make XiaoBot say what you wish.', description: 'Make XiaoBot say what you wish.',
guildOnly: true,
args: [ args: [
{ {
key: 'text', key: 'text',
@@ -19,9 +18,9 @@ module.exports = class SayCommand extends Command {
}); });
} }
run(msg, args) { async run(msg, args) {
const { text } = 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); return msg.say(text);
} }
}; };
+17 -16
View File
@@ -1,6 +1,7 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js'); const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch'); const snekfetch = require('snekfetch');
const { list } = require('../../structures/Util');
const codes = require('../../assets/json/translate'); const codes = require('../../assets/json/translate');
const { YANDEX_KEY } = process.env; const { YANDEX_KEY } = process.env;
@@ -11,7 +12,7 @@ module.exports = class TranslateCommand extends Command {
group: 'text-edit', group: 'text-edit',
memberName: 'translate', memberName: 'translate',
description: 'Translates text to a specified language.', 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'], clientPermissions: ['EMBED_LINKS'],
args: [ args: [
{ {
@@ -20,42 +21,42 @@ module.exports = class TranslateCommand extends Command {
type: 'string', type: 'string',
validate: text => { validate: text => {
if (text.length < 500) return true; if (text.length < 500) return true;
return 'Text must be under 500 characters.'; return 'Please keep text under 500 characters.';
} }
}, },
{ {
key: 'to', key: 'target',
prompt: 'Which language is being translated to?', prompt: 'Which language would you like to translate to?',
type: 'string', type: 'string',
validate: to => { validate: target => {
if (codes[to.toLowerCase()]) return true; if (codes[target.toLowerCase()]) return true;
return 'Invalid Language Code. Use `help translate` for a list of codes.'; return `Invalid target, please enter either ${list(Object.keys(codes), 'or')}.`;
}, },
parse: to => to.toLowerCase() parse: target => target.toLowerCase()
}, },
{ {
key: 'from', key: 'original',
prompt: 'Which language is being translated from?', prompt: 'Which language is your text in?',
type: 'string', type: 'string',
default: '', default: '',
validate: from => { validate: original => {
if (codes[from.toLowerCase()]) return true; if (codes[original.toLowerCase()]) return true;
return 'Invalid Language Code. Use `help translate` for a list of codes.'; return `Invalid original, please enter either ${list(Object.keys(codes), 'or')}.`;
}, },
parse: from => from.toLowerCase() parse: original => original.toLowerCase()
} }
] ]
}); });
} }
async run(msg, args) { async run(msg, args) {
const { text, to, from } = args; const { text, target, original } = args;
const { body } = await snekfetch const { body } = await snekfetch
.get('https://translate.yandex.net/api/v1.5/tr.json/translate') .get('https://translate.yandex.net/api/v1.5/tr.json/translate')
.query({ .query({
key: YANDEX_KEY, key: YANDEX_KEY,
text, text,
lang: from ? `${from}-${to}` : to lang: original ? `${original}-${target}` : target
}); });
const lang = body.lang.split('-'); const lang = body.lang.split('-');
const embed = new MessageEmbed() const embed = new MessageEmbed()
+1 -3
View File
@@ -10,9 +10,7 @@ module.exports = class WebhookCommand extends Command {
group: 'text-edit', group: 'text-edit',
memberName: 'webhook', memberName: 'webhook',
description: 'Posts a message to the webhook defined in your `process.env`.', description: 'Posts a message to the webhook defined in your `process.env`.',
guildOnly: true,
ownerOnly: true, ownerOnly: true,
clientPermissions: ['MANAGE_MESSAGES'],
args: [ args: [
{ {
key: 'content', key: 'content',
@@ -25,7 +23,7 @@ module.exports = class WebhookCommand extends Command {
async run(msg, args) { async run(msg, args) {
const { content } = args; const { content } = args;
msg.delete(); if (msg.guild && msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES')) await msg.delete();
await snekfetch await snekfetch
.post(WEBHOOK_URL) .post(WEBHOOK_URL)
.send({ content }); .send({ content });
+1 -1
View File
@@ -17,7 +17,7 @@ module.exports = class YodaCommand extends Command {
type: 'string', type: 'string',
validate: sentence => { validate: sentence => {
if (sentence.length < 500) return true; if (sentence.length < 500) return true;
return 'Text must be under 500 characters.'; return 'Please keep text under 500 characters.';
} }
} }
] ]
+2 -2
View File
@@ -7,7 +7,7 @@ module.exports = class ZalgoCommand extends Command {
name: 'zalgo', name: 'zalgo',
group: 'text-edit', group: 'text-edit',
memberName: 'zalgo', memberName: 'zalgo',
description: 'Converts text to Zalgo.', description: 'Converts text to zalgo.',
args: [ args: [
{ {
key: 'text', key: 'text',
@@ -15,7 +15,7 @@ module.exports = class ZalgoCommand extends Command {
type: 'string', type: 'string',
validate: text => { validate: text => {
if (text.length < 500) return true; if (text.length < 500) return true;
return 'Text must be under 500 characters.'; return 'Please keep text under 500 characters.';
} }
} }
] ]
+9 -4
View File
@@ -1,7 +1,12 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js'); const { MessageEmbed } = require('discord.js');
const moment = require('moment'); 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 { module.exports = class UserInfoCommand extends Command {
constructor(client) { constructor(client) {
@@ -16,7 +21,7 @@ module.exports = class UserInfoCommand extends Command {
args: [ args: [
{ {
key: 'member', key: 'member',
prompt: 'Which user would you like to get info on?', prompt: 'Which user would you like to get information on?',
type: 'member', type: 'member',
default: '' default: ''
} }
@@ -38,9 +43,9 @@ module.exports = class UserInfoCommand extends Command {
.addField(' Server Join Date', .addField(' Server Join Date',
moment(member.joinedTimestamp).format('MMMM Do YYYY'), true) moment(member.joinedTimestamp).format('MMMM Do YYYY'), true)
.addField(' Status', .addField(' Status',
statuses[member.user.presence.status], true) statuses[member.presence.status], true)
.addField(' Playing', .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', .addField(' Highest Role',
member.highestRole.name !== '@everyone' ? member.highestRole.name : 'None', true) member.highestRole.name !== '@everyone' ? member.highestRole.name : 'None', true)
.addField(' Hoist Role', .addField(' Hoist Role',
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "xiaobot", "name": "xiaobot",
"version": "31.1.4", "version": "31.5.0",
"description": "Your personal server companion.", "description": "Your personal server companion.",
"main": "Shard.js", "main": "Shard.js",
"scripts": { "scripts": {
+2 -2
View File
@@ -22,14 +22,14 @@ class XiaoCommand extends Command {
if (this.clientPermissions) { if (this.clientPermissions) {
for (const permission of this.clientPermissions) { for (const permission of this.clientPermissions) {
if (!msg.channel.permissionsFor(this.client.user).has(permission)) { 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) { if (this.userPermissions) {
for (const permission of this.userPermissions) { for (const permission of this.userPermissions) {
if (!msg.channel.permissionsFor(msg.author).has(permission)) { 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.`;
} }
} }
} }