Change Variable Names, Remove Useless Commands

This commit is contained in:
Daniel Odendahl Jr
2017-04-29 19:53:01 +00:00
parent 3c773a8952
commit 988912f471
52 changed files with 236 additions and 312 deletions
+5 -5
View File
@@ -24,14 +24,14 @@ module.exports = class YearsCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
return message.say('This Command requires the `Attach Files` Permission.');
const { user } = args;
const userAvatar = user.displayAvatarURL.replace(/(png|jpg|jpeg|gif|webp)/, 'png');
const avatarURL = user.displayAvatarURL.replace(/(png|jpg|jpeg|gif|webp)/, 'png');
let images = [];
images.push(Jimp.read(userAvatar));
images.push(Jimp.read(avatarURL));
images.push(Jimp.read('https://i.imgur.com/eScwGFS.png'));
const [avatar, years] = await Promise.all(images);
const [avatar, az] = await Promise.all(images);
avatar.resize(200, 200);
years.composite(avatar, 461, 127);
years.getBuffer(Jimp.MIME_PNG, (err, buff) => {
az.composite(avatar, 461, 127);
az.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return message.say('An Unknown Error Occurred.');
return message.channel.send({files: [{attachment: buff}]});
});
+6 -6
View File
@@ -24,16 +24,16 @@ module.exports = class BeautifulCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
return message.say('This Command requires the `Attach Files` Permission.');
const { user } = args;
const userAvatar = user.displayAvatarURL.replace(/(png|jpg|jpeg|gif|webp)/, 'png');
const avatarURL = user.displayAvatarURL.replace(/(png|jpg|jpeg|gif|webp)/, 'png');
let images = [];
images.push(Jimp.read(userAvatar));
images.push(Jimp.read(avatarURL));
images.push(Jimp.read('https://i.imgur.com/OOQ9QwQ.jpg'));
const [avatar, beautiful] = await Promise.all(images);
const [avatar, grunkle] = await Promise.all(images);
avatar.resize(200, 200);
beautiful.composite(avatar, 432, 42);
grunkle.composite(avatar, 432, 42);
avatar.resize(190, 190);
beautiful.composite(avatar, 451, 434);
beautiful.getBuffer(Jimp.MIME_PNG, (err, buff) => {
grunkle.composite(avatar, 451, 434);
grunkle.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return message.say('An Unknown Error Occurred.');
return message.channel.send({files: [{attachment: buff}]});
});
+2 -2
View File
@@ -24,10 +24,10 @@ module.exports = class BobRossCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
return message.say('This Command requires the `Attach Files` Permission.');
const { user } = args;
const userAvatar = user.displayAvatarURL.replace(/(png|jpg|jpeg|gif|webp)/, 'png');
const avatarURL = user.displayAvatarURL.replace(/(png|jpg|jpeg|gif|webp)/, 'png');
const blank = new Jimp(600, 775, 0xFFFFFFFF);
let images = [];
images.push(Jimp.read(userAvatar));
images.push(Jimp.read(avatarURL));
images.push(Jimp.read('https://i.imgur.com/7NSiFLd.png'));
const [avatar, bob] = await Promise.all(images);
avatar.rotate(2);
+5 -5
View File
@@ -25,14 +25,14 @@ module.exports = class RIPCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
return message.say('This Command requires the `Attach Files` Permission.');
const { user } = args;
const userAvatar = user.displayAvatarURL.replace(/(png|jpg|jpeg|gif|webp)/, 'png');
const avatarURL = user.displayAvatarURL.replace(/(png|jpg|jpeg|gif|webp)/, 'png');
let images = [];
images.push(Jimp.read(userAvatar));
images.push(Jimp.read(avatarURL));
images.push(Jimp.read('https://i.imgur.com/KriteWm.jpg'));
const [avatar, gravestone] = await Promise.all(images);
const [avatar, grave] = await Promise.all(images);
avatar.resize(200, 200);
gravestone.composite(avatar, 158, 51);
gravestone.getBuffer(Jimp.MIME_PNG, (err, buff) => {
grave.composite(avatar, 158, 51);
grave.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return message.say('An Unknown Error Occurred.');
return message.channel.send({files: [{attachment: buff}]});
});
+4 -4
View File
@@ -25,16 +25,16 @@ module.exports = class SteamCardCommand extends Command {
return message.say('This Command requires the `Attach Files` Permission.');
const { user } = args;
const username = message.guild ? message.guild.member(user).displayName : user.username;
const userAvatar = user.displayAvatarURL.replace(/(png|jpg|jpeg|gif|webp)/, 'png');
const avatarURL = user.displayAvatarURL.replace(/(png|jpg|jpeg|gif|webp)/, 'png');
const blank = new Jimp(494, 568, 0xFFFFFFFF);
let images = [];
images.push(Jimp.read(userAvatar));
images.push(Jimp.read(avatarURL));
images.push(Jimp.read('https://i.imgur.com/JF0WwQX.png'));
const [avatar, steamcard] = await Promise.all(images);
const [avatar, card] = await Promise.all(images);
const font = await Jimp.loadFont(Jimp.FONT_SANS_32_WHITE);
avatar.resize(450, 450);
blank.composite(avatar, 25, 25);
blank.composite(steamcard, 0, 0);
blank.composite(card, 0, 0);
blank.print(font, 38, 20, username);
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return message.say('An Unknown Error Occurred.');
+2 -2
View File
@@ -21,10 +21,10 @@ module.exports = class TriggeredCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
return message.say('This Command requires the `Attach Files` Permission.');
const { user } = args;
const userAvatar = user.displayAvatarURL.replace(/(png|jpg|jpeg|gif|webp)/, 'png');
const avatarURL = user.displayAvatarURL.replace(/(png|jpg|jpeg|gif|webp)/, 'png');
const blank = new Jimp(320, 371, 0xFFFFFFFF);
let images = [];
images.push(Jimp.read(userAvatar));
images.push(Jimp.read(avatarURL));
images.push(Jimp.read('https://i.imgur.com/tF9yF62.png'));
const [avatar, triggered] = await Promise.all(images);
avatar.resize(320, 320);
+4 -4
View File
@@ -19,7 +19,7 @@ module.exports = class MathGameCommand extends Command {
return true;
return 'Please set the difficulty to either `easy`, `medium`, `hard`, `extreme`, or `impossible`.';
},
parse: text => text.toLowerCase()
parse: difficulty => difficulty.toLowerCase()
}]
});
}
@@ -51,9 +51,9 @@ module.exports = class MathGameCommand extends Command {
const value1 = Math.floor(Math.random() * value) + 1;
const value2 = Math.floor(Math.random() * value) + 1;
const expression = `${value1} ${operation} ${value2}`;
const solved = math.eval(expression);
const solved = math.eval(expression).toString();
const embed = new RichEmbed()
.setTitle('You have **ten** seconds to answer:')
.setTitle('You have **10** seconds to answer:')
.setDescription(expression);
await message.embed(embed);
try {
@@ -62,7 +62,7 @@ module.exports = class MathGameCommand extends Command {
time: 10000,
errors: ['time']
});
if (collected.first().content !== solved.toString())
if (collected.first().content !== solved)
return message.say(`Aw... Too bad, try again next time!\nThe correct answer is: ${solved}`);
return message.say(`Good Job! You won! ${solved} is the correct answer!`);
} catch (err) {
+4 -5
View File
@@ -22,11 +22,10 @@ module.exports = class QuizCommand extends Command {
try {
const { body } = await request
.get('http://jservice.io/api/random?count=1');
const data = body[0];
const answer = data.answer.toLowerCase().replace(/(<i>|<\/i>)/g, '');
const answer = body[0].answer.toLowerCase().replace(/(<i>|<\/i>)/g, '');
const embed = new RichEmbed()
.setTitle('You have **fifteen** seconds to answer this question:')
.setDescription(`**Category: ${data.category.title}**\n${data.question}`);
.setTitle('You have **15** seconds to answer this question:')
.setDescription(`**Category: ${body[0].category.title}**\n${body[0].question}`);
await message.embed(embed);
try {
const collected = await message.channel.awaitMessages(res => res.author.id === message.author.id, {
@@ -41,7 +40,7 @@ module.exports = class QuizCommand extends Command {
return message.say(`Aw... Too bad, try again next time!\nThe Correct Answer was: ${answer}`);
}
} catch (err) {
return message.say(':x: Error! Something went wrong!');
return message.say('An Unknown Error Occurred.');
}
}
};
+3 -3
View File
@@ -15,12 +15,12 @@ module.exports = class RockPaperScissorsCommand extends Command {
key: 'choice',
prompt: '`Rock`, `Paper`, or `Scissors`?',
type: 'string',
validate: rps => {
if (['rock', 'paper', 'scissors'].includes(rps.toLowerCase()))
validate: choice => {
if (['rock', 'paper', 'scissors'].includes(choice.toLowerCase()))
return true;
return 'Please enter either `rock`, `paper`, or `scissors`.';
},
parse: text => text.toLowerCase()
parse: choice => choice.toLowerCase()
}]
});
}
+2 -8
View File
@@ -18,7 +18,7 @@ module.exports = class TypingGameCommand extends Command {
return true;
return 'Please set the difficulty to either `easy`, `medium`, `hard`, `extreme`, or `impossible`.';
},
parse: text => text.toLowerCase()
parse: difficulty => difficulty.toLowerCase()
}]
});
}
@@ -30,31 +30,25 @@ module.exports = class TypingGameCommand extends Command {
const { difficulty } = args;
const sentence = sentences[Math.floor(Math.random() * sentences.length)];
let time;
let levelWord;
switch (difficulty) {
case 'easy':
time = 25000;
levelWord = 'twenty-five';
break;
case 'medium':
time = 20000;
levelWord = 'twenty';
break;
case 'hard':
time = 15000;
levelWord = 'fifteen';
break;
case 'extreme':
time = 10000;
levelWord = 'ten';
break;
case 'impossible':
time = 5000;
levelWord = 'five';
break;
}
const embed = new RichEmbed()
.setTitle(`You have **${levelWord}** seconds to type:`)
.setTitle(`You have **${time / 1000}** seconds to type:`)
.setDescription(sentence);
await message.embed(embed);
try {
+16 -16
View File
@@ -1,5 +1,5 @@
const { Command } = require('discord.js-commando');
const memecodes = require('./memecodes');
const codes = require('./memecodes');
module.exports = class MemeCommand extends Command {
constructor(client) {
@@ -8,37 +8,37 @@ module.exports = class MemeCommand extends Command {
group: 'imageedit',
memberName: 'meme',
description: 'Sends a Meme with text of your choice, and a background of your choice.',
details: `**Codes:** ${memecodes.join(', ')}`,
details: `**Codes:** ${codes.join(', ')}`,
args: [{
key: 'type',
prompt: 'What meme type do you want to use?',
type: 'string',
validate: type => {
if (memecodes.includes(type.toLowerCase()))
if (codes.includes(type.toLowerCase()))
return true;
return `${type.toLowerCase()} is not a valid meme type. Use \`x;help meme\` to view a list of types.`;
},
parse: text => text.toLowerCase()
parse: type => type.toLowerCase()
}, {
key: 'toprow',
key: 'top',
prompt: 'What should the top row of the meme to be?',
type: 'string',
validate: toprow => {
if (/[a-zA-Z0-9.,!?'\s]+$/g.test(toprow) && toprow.length < 100)
validate: top => {
if (/[a-zA-Z0-9.,!?'\s]+$/g.test(top) && top.length < 100)
return true;
return `Please do not use special characters and keep the rows under 100 characters each, top row has ${toprow.length}.`;
return `Please do not use special characters and keep the rows under 100 characters each, top row has ${top.length}.`;
},
parse: text => text.replace(/[ ]/g, '-').replace(/[?]/g, '~q')
parse: top => top.replace(/[ ]/g, '-').replace(/[?]/g, '~q')
}, {
key: 'bottomrow',
key: 'bottom',
prompt: 'What should the bottom row of the meme to be?',
type: 'string',
validate: bottomrow => {
if (/[a-zA-Z0-9.,!?'\s]+$/g.test(bottomrow) && bottomrow.length < 100)
validate: bottom => {
if (/[a-zA-Z0-9.,!?'\s]+$/g.test(bottom) && bottom.length < 100)
return true;
return `Please do not use special characters and keep the rows under 100 characters each, bottom row has ${bottomrow.length}.`;
return `Please do not use special characters and keep the rows under 100 characters each, bottom row has ${bottom.length}.`;
},
parse: text => text.replace(/[ ]/g, '-').replace(/[?]/g, '~q')
parse: bottom => bottom.replace(/[ ]/g, '-').replace(/[?]/g, '~q')
}]
});
}
@@ -47,8 +47,8 @@ module.exports = class MemeCommand extends Command {
if (message.channel.type !== 'dm')
if (!message.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
return message.say('This Command requires the `Attach Files` Permission.');
const { type, toprow, bottomrow } = args;
return message.channel.send({files: [`https://memegen.link/${type}/${toprow}/${bottomrow}.jpg`]})
const { type, top, bottom } = args;
return message.channel.send({files: [`https://memegen.link/${type}/${top}/${bottom}.jpg`]})
.catch(() => message.say('An Unknown Error Occurred.'));
}
};
+1 -1
View File
@@ -54,7 +54,7 @@ module.exports = class BanCommand extends Command {
await member.ban(7);
await message.say(':ok_hand:');
const embed = new RichEmbed()
.setAuthor(message.author.tag, message.author.avatarURL)
.setAuthor(message.author.tag, message.author.displayAvatarURL)
.setColor(0xFF0000)
.setTimestamp()
.setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Ban\n**Reason:** ${reason}`);
+1 -1
View File
@@ -51,7 +51,7 @@ module.exports = class KickCommand extends Command {
await member.kick();
await message.say(':ok_hand:');
const embed = new RichEmbed()
.setAuthor(message.author.tag, message.author.avatarURL)
.setAuthor(message.author.tag, message.author.displayAvatarURL)
.setColor(0xFFA500)
.setTimestamp()
.setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Kick\n**Reason:** ${reason}`);
+1 -1
View File
@@ -17,7 +17,7 @@ module.exports = class LockdownCommand extends Command {
return true;
return 'Please enter either `start` or `stop`.';
},
parse: text => text.toLowerCase()
parse: type => type.toLowerCase()
}]
});
}
+2 -3
View File
@@ -34,11 +34,10 @@ module.exports = class PruneCommand extends Command {
return message.say('This Command requires the `Read Message History` Permission.');
if (!message.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES'))
return message.say('This Command requires the `Manage Messages` Permission.');
let { count } = args;
count = count + 1;
const { count } = args;
try {
const messages = await message.channel.fetchMessages({
limit: count
limit: count + 1
});
await message.channel.bulkDelete(messages, true);
return null;
+10 -10
View File
@@ -13,13 +13,13 @@ module.exports = class UnbanCommand extends Command {
description: 'Unbans a user and logs the unban to the mod_logs.',
guildOnly: true,
args: [{
key: 'memberID',
key: 'id',
prompt: 'What member do you want to unban? Please enter the ID of the user.',
type: 'string',
validate: userID => {
if (userID.length === 18)
validate: id => {
if (id.length === 18)
return true;
return `${userID} is not a valid ID. Please enter the user you wish to unban's ID.`;
return `${id} is not a valid ID. Please enter the user you wish to unban's ID.`;
}
}, {
key: 'reason',
@@ -46,19 +46,19 @@ module.exports = class UnbanCommand extends Command {
return message.say('This Command requires a channel named `mod_logs` or one custom set with the `modchannel` command.');
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
return message.say('This Command requires the `Embed Links` Permission.');
const { memberID, reason } = args;
const { id, reason } = args;
const bans = await message.guild.fetchBans();
if (!bans.has(memberID))
if (!bans.has(id))
return message.say('This ID is not in the Guild Banlist.');
const unbanUser = await bans.get(memberID);
const member = await bans.get(id);
try {
await message.guild.unban(unbanUser);
await message.guild.unban(member);
await message.say(':ok_hand:');
const embed = new RichEmbed()
.setAuthor(message.author.tag, message.author.avatarURL)
.setAuthor(message.author.tag, message.author.displayAvatarURL)
.setColor(0x00AE86)
.setTimestamp()
.setDescription(`**Member:** ${unbanUser.tag} (${unbanUser.id})\n**Action:** Unban\n**Reason:** ${reason}`);
.setDescription(`**Member:** ${member.tag} (${member.id})\n**Action:** Unban\n**Reason:** ${reason}`);
return modlogs.send({embed});
} catch (err) {
return message.say('An Unknown Error Occurred.');
+1 -1
View File
@@ -40,7 +40,7 @@ module.exports = class WarnCommand extends Command {
try {
await message.say(':ok_hand:');
const embed = new RichEmbed()
.setAuthor(message.author.tag, message.author.avatarURL)
.setAuthor(message.author.tag, message.author.displayAvatarURL)
.setColor(0xFFFF00)
.setTimestamp()
.setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Warn\n**Reason:** ${reason}`);
-16
View File
@@ -1,16 +0,0 @@
const { Command } = require('discord.js-commando');
module.exports = class CanYouNotCommand extends Command {
constructor(client) {
super(client, {
name: 'canyounot',
group: 'random',
memberName: 'canyounot',
description: 'Can YOU not?'
});
}
run(message) {
return message.say('Can YOU not?');
}
};
+1 -1
View File
@@ -20,7 +20,7 @@ module.exports = class EasterEggCommand extends Command {
return true;
return 'Nope, that\'s not a valid easter egg. Try again!';
},
parse: text => text.toLowerCase()
parse: tag => tag.toLowerCase()
}]
});
}
+4 -1
View File
@@ -21,5 +21,8 @@
"egg": "You're an egg.",
"beta": "https://cdn.discordapp.com/attachments/252317073814978561/304812045851688963/image.jpg",
"pathetic": "https://cdn.discordapp.com/attachments/252317073814978561/304812045851688963/image.jpg",
"swagolor": "https://cdn.discordapp.com/attachments/252317073814978561/306110096491151363/Swagolor.png"
"swagolor": "https://cdn.discordapp.com/attachments/252317073814978561/306110096491151363/Swagolor.png",
"canyounot": "Can YOU not?",
"slowclap": "*slow clap*",
"justdoit": "https://www.youtube.com/watch?v=ZXsQAXx_ao0"
}
-22
View File
@@ -1,22 +0,0 @@
const { Command } = require('discord.js-commando');
module.exports = class MotivateCommand extends Command {
constructor(client) {
super(client, {
name: 'motivate',
group: 'random',
memberName: 'motivate',
description: 'Motivates something/someone.',
args: [{
key: 'thing',
prompt: 'What do you want to motivate?',
type: 'string'
}]
});
}
run(message, args) {
const { thing } = args;
return message.say(`${thing}, https://www.youtube.com/watch?v=ZXsQAXx_ao0`);
}
};
+1 -1
View File
@@ -20,7 +20,7 @@ module.exports = class NitroCommand extends Command {
.setThumbnail('https://pbs.twimg.com/profile_images/814184180649197568/y2eZcVMq.jpg')
.setColor(0x748BD9)
.setURL('https://discordapp.com/nitro')
.setDescription('This Message can only be viewed by members with Discord Nitro.\n\n\n[More Information](https://discordapp.com/nitro)');
.setDescription('This Message can only be viewed by members with Discord Nitro.\n[More Information](https://discordapp.com/nitro)');
return message.embed(embed);
}
};
-16
View File
@@ -1,16 +0,0 @@
const { Command } = require('discord.js-commando');
module.exports = class SlowClapCommand extends Command {
constructor(client) {
super(client, {
name: 'slowclap',
group: 'random',
memberName: 'slowclap',
description: '*Slow Clap*.'
});
}
run(message) {
return message.say('*slow clap*');
}
};
+6 -6
View File
@@ -20,15 +20,15 @@ module.exports = class TodayCommand extends Command {
const { text } = await request
.get('http://history.muffinlabs.com/date')
.buffer(true);
const data = JSON.parse(text);
const events = data.data.Events;
const randomNumber = Math.floor(Math.random() * events.length);
const parsed = JSON.parse(text);
const events = parsed.data.Events;
const random = Math.floor(Math.random() * events.length);
const embed = new RichEmbed()
.setColor(0x9797FF)
.setURL(data.url)
.setTitle(`On this day (${data.date})...`)
.setURL(parsed.url)
.setTitle(`On this day (${parsed.date})...`)
.setTimestamp()
.setDescription(`${events[randomNumber].text} (${events[randomNumber].year})`);
.setDescription(`${events[random].year}: ${events[random].text}`);
return message.embed(embed);
} catch (err) {
return message.say('An Unknown Error Occurred.');
+2 -2
View File
@@ -16,7 +16,7 @@ module.exports = class CoinFlipCommand extends Command {
}
run(message) {
const coin = sides[Math.floor(Math.random() * sides.length)];
return message.say(`It landed on ${coin}!`);
const side = sides[Math.floor(Math.random() * sides.length)];
return message.say(`It landed on ${side}!`);
}
};
+1 -1
View File
@@ -17,7 +17,7 @@ module.exports = class RandomNameCommand extends Command {
return true;
return 'Please enter either `male` or `female`.';
},
parse: text => text.toLowerCase()
parse: gender => gender.toLowerCase()
}]
});
}
+2 -2
View File
@@ -15,7 +15,7 @@ module.exports = class QuantumCoinCommand extends Command {
}
run(message) {
const qcoin = sides[Math.floor(Math.random() * sides.length)];
return message.say(`It landed ${qcoin}.`);
const side = sides[Math.floor(Math.random() * sides.length)];
return message.say(`It landed ${side}.`);
}
};
+2 -2
View File
@@ -20,7 +20,7 @@ module.exports = class ShipCommand extends Command {
run(message, args) {
const { things } = args;
const percentage = Math.floor(Math.random() * 100) + 1;
return message.say(`I'd give ${things} a ${percentage}%!`);
const rating = Math.floor(Math.random() * 100) + 1;
return message.say(`I'd give ${things} a ${rating}%!`);
}
};
+2 -3
View File
@@ -21,11 +21,10 @@ module.exports = class BotSearchCommand extends Command {
if (message.channel.type !== 'dm')
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
return message.say('This Command requires the `Embed Links` Permission.');
let { bot } = args;
bot = bot.id;
const { bot } = args;
try {
const { body } = await request
.get(`https://bots.discord.pw/api/bots/${bot}`)
.get(`https://bots.discord.pw/api/bots/${bot.id}`)
.set({
'Authorization': process.env.DISCORD_BOTS_KEY
});
+6 -7
View File
@@ -10,10 +10,10 @@ module.exports = class DefineCommand extends Command {
memberName: 'define',
description: 'Defines a word.',
args: [{
key: 'word',
key: 'query',
prompt: 'What would you like to define?',
type: 'string',
parse: text => encodeURIComponent(text)
parse: query => encodeURIComponent(query)
}]
});
}
@@ -22,15 +22,14 @@ module.exports = class DefineCommand extends Command {
if (message.channel.type !== 'dm')
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
return message.say('This Command requires the `Embed Links` Permission.');
const { word } = args;
const { query } = args;
try {
const { body } = await request
.get(`http://api.wordnik.com:80/v4/word.json/${word}/definitions?limit=1&includeRelated=false&useCanonical=false&api_key=${process.env.WORDNIK_KEY}`);
const data = body[0];
.get(`http://api.wordnik.com:80/v4/word.json/${query}/definitions?limit=1&includeRelated=false&useCanonical=false&api_key=${process.env.WORDNIK_KEY}`);
const embed = new RichEmbed()
.setColor(0x9797FF)
.setTitle(data.word)
.setDescription(data.text);
.setTitle(body[0].word)
.setDescription(body[0].text);
return message.embed(embed);
} catch (err) {
return message.say('An Error Occurred. The word may not have been found.');
+20 -21
View File
@@ -10,7 +10,7 @@ module.exports = class ForecastCommand extends Command {
memberName: 'forecast',
description: 'Gets the seven-day forecast for a specified location.',
args: [{
key: 'location',
key: 'query',
prompt: 'What location would you like to get the forecast for?',
type: 'string'
}]
@@ -21,31 +21,30 @@ module.exports = class ForecastCommand extends Command {
if (message.channel.type !== 'dm')
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
return message.say('This Command requires the `Embed Links` Permission.');
const { location } = args;
const { query } = args;
try {
const { body } = await request
.get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${location}")&format=json`);
const info = body.query.results.channel;
const data = info.item.forecast;
.get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${query}")&format=json`);
const forecasts = body.query.results.channel.item.forecast;
const embed = new RichEmbed()
.setColor(0x0000FF)
.setAuthor(info.title, 'http://media.idownloadblog.com/wp-content/uploads/2013/12/yahoo-weather-213x220.png')
.setURL(info.link)
.setAuthor(body.query.results.channel.title, 'http://media.idownloadblog.com/wp-content/uploads/2013/12/yahoo-weather-213x220.png')
.setURL(body.query.results.channel.link)
.setTimestamp()
.addField(`**${data[0].day} - ${data[0].date}:**`,
`**High:** ${data[0].high}°F, **Low:** ${data[0].low}°F, **Condition:** ${data[0].text}`)
.addField(`**${data[1].day} - ${data[1].date}:**`,
`**High:** ${data[1].high}°F, **Low:** ${data[1].low}°F, **Condition:** ${data[1].text}`)
.addField(`**${data[2].day} - ${data[2].date}:**`,
`**High:** ${data[2].high}°F, **Low:** ${data[2].low}°F, **Condition:** ${data[2].text}`)
.addField(`**${data[3].day} - ${data[3].date}:**`,
`**High:** ${data[3].high}°F, **Low:** ${data[3].low}°F, **Condition:** ${data[3].text}`)
.addField(`**${data[4].day} - ${data[4].date}:**`,
`**High:** ${data[4].high}°F, **Low:** ${data[4].low}°F, **Condition:** ${data[4].text}`)
.addField(`**${data[5].day} - ${data[5].date}:**`,
`**High:** ${data[5].high}°F, **Low:** ${data[5].low}°F, **Condition:** ${data[5].text}`)
.addField(`**${data[6].day} - ${data[6].date}:**`,
`**High:** ${data[6].high}°F, **Low:** ${data[6].low}°F, **Condition:** ${data[6].text}`);
.addField(`**${forecasts[0].day} - ${forecasts[0].date}:**`,
`**High:** ${forecasts[0].high}°F, **Low:** ${forecasts[0].low}°F, **Condition:** ${forecasts[0].text}`)
.addField(`**${forecasts[1].day} - ${forecasts[1].date}:**`,
`**High:** ${forecasts[1].high}°F, **Low:** ${forecasts[1].low}°F, **Condition:** ${forecasts[1].text}`)
.addField(`**${forecasts[2].day} - ${forecasts[2].date}:**`,
`**High:** ${forecasts[2].high}°F, **Low:** ${forecasts[2].low}°F, **Condition:** ${forecasts[2].text}`)
.addField(`**${forecasts[3].day} - ${forecasts[3].date}:**`,
`**High:** ${forecasts[3].high}°F, **Low:** ${forecasts[3].low}°F, **Condition:** ${forecasts[3].text}`)
.addField(`**${forecasts[4].day} - ${forecasts[4].date}:**`,
`**High:** ${forecasts[4].high}°F, **Low:** ${forecasts[4].low}°F, **Condition:** ${forecasts[4].text}`)
.addField(`**${forecasts[5].day} - ${forecasts[5].date}:**`,
`**High:** ${forecasts[5].high}°F, **Low:** ${forecasts[5].low}°F, **Condition:** ${forecasts[5].text}`)
.addField(`**${forecasts[6].day} - ${forecasts[6].date}:**`,
`**High:** ${forecasts[6].high}°F, **Low:** ${forecasts[6].low}°F, **Condition:** ${forecasts[6].text}`);
return message.embed(embed);
} catch (err) {
return message.say('An Error Occurred. The location may not have been found.');
+1 -1
View File
@@ -14,7 +14,7 @@ module.exports = class GoogleCommand extends Command {
key: 'query',
prompt: 'What would you like to search for?',
type: 'string',
parse: text => encodeURIComponent(text)
parse: query => encodeURIComponent(query)
}]
});
}
+4 -4
View File
@@ -10,10 +10,10 @@ module.exports = class IMDBCommand extends Command {
memberName: 'imdb',
description: 'Searches IMDB for a specified movie.',
args: [{
key: 'movie',
key: 'query',
prompt: 'What movie or TV Show would you like to search for?',
type: 'string',
parse: text => encodeURIComponent(text)
parse: query => encodeURIComponent(query)
}]
});
}
@@ -22,10 +22,10 @@ module.exports = class IMDBCommand extends Command {
if (message.channel.type !== 'dm')
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
return message.say('This Command requires the `Embed Links` Permission.');
const { movie } = args;
const { query } = args;
try {
const { body } = await request
.get(`http://www.omdbapi.com/?t=${movie}&plot=full`);
.get(`http://www.omdbapi.com/?t=${query}&plot=full`);
const embed = new RichEmbed()
.setColor(0xDBA628)
.setAuthor('IMDB', 'http://static.wixstatic.com/media/c65cbf_31901b544fe24f1890134553bf40c8be.png')
+1 -1
View File
@@ -11,7 +11,7 @@ module.exports = class LMGTFYCommand extends Command {
key: 'query',
prompt: 'What would you like to the link to search for?',
type: 'string',
parse: text => encodeURIComponent(text)
parse: query => encodeURIComponent(query)
}]
});
}
+4 -4
View File
@@ -18,10 +18,10 @@ module.exports = class MapCommand extends Command {
return 'Please enter a zoom value from 1-20';
}
}, {
key: 'location',
key: 'query',
prompt: 'What location you like to get a map image for?',
type: 'string',
parse: text => encodeURIComponent(text)
parse: query => encodeURIComponent(query)
}]
});
}
@@ -30,10 +30,10 @@ module.exports = class MapCommand extends Command {
if (message.channel.type !== 'dm')
if (!message.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
return message.say('This Command requires the `Attach Files` Permission.');
const { zoom, location } = args;
const { zoom, query } = args;
try {
const { body } = await request
.get(`https://maps.googleapis.com/maps/api/staticmap?center=${location}&zoom=${zoom}&size=500x500&key=${process.env.GOOGLE_KEY}`);
.get(`https://maps.googleapis.com/maps/api/staticmap?center=${query}&zoom=${zoom}&size=500x500&key=${process.env.GOOGLE_KEY}`);
return message.channel.send({files: [{attachment: body}]});
} catch (err) {
return message.say('An Error Occurred. The location may not have been found.');
+4 -4
View File
@@ -10,19 +10,19 @@ module.exports = class NeopetCommand extends Command {
memberName: 'neopet',
description: 'Gives a Neopet\'s image, searchable by name.',
args: [{
key: 'pet',
key: 'query',
prompt: 'What pet would you like to get the image of?',
type: 'string',
parse: text => encodeURIComponent(text)
parse: query => encodeURIComponent(query)
}]
});
}
async run(message, args) {
const { pet } = args;
const { query } = args;
try {
const { text } = await request
.get(`http://www.sunnyneo.com/petimagefinder.php?name=${pet}&size=5&mood=1`);
.get(`http://www.sunnyneo.com/petimagefinder.php?name=${query}&size=5&mood=1`);
const $ = cheerio.load(text);
const link = $('textarea').first().text();
if (!link.includes('cp'))
+16 -17
View File
@@ -10,10 +10,10 @@ module.exports = class OsuCommand extends Command {
memberName: 'osu',
description: 'Searches Osu! user data.',
args: [{
key: 'username',
key: 'query',
prompt: 'What osu username would you like to search for?',
type: 'string',
parse: text => encodeURIComponent(text)
parse: query => encodeURIComponent(query)
}]
});
}
@@ -22,39 +22,38 @@ module.exports = class OsuCommand extends Command {
if (message.channel.type !== 'dm')
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
return message.say('This Command requires the `Embed Links` Permission.');
const { username } = args;
const { query } = args;
try {
const { body } = await request
.get(`https://osu.ppy.sh/api/get_user?k=${process.env.OSU_KEY}&u=${username}&type=string`);
const data = body[0];
.get(`https://osu.ppy.sh/api/get_user?k=${process.env.OSU_KEY}&u=${query}&type=string`);
const embed = new RichEmbed()
.setColor(0xFF66AA)
.setAuthor('osu!', 'http://vignette3.wikia.nocookie.net/osugame/images/c/c9/Logo.png/revision/latest?cb=20151219073209')
.setURL('https://osu.ppy.sh/')
.addField('**Username:**',
data.username, true)
body[0].username, true)
.addField('**ID:**',
data.user_id, true)
body[0].user_id, true)
.addField('**Level:**',
data.level, true)
body[0].level, true)
.addField('**Accuracy**',
data.accuracy, true)
body[0].accuracy, true)
.addField('**Rank:**',
data.pp_rank, true)
body[0].pp_rank, true)
.addField('**Play Count:**',
data.playcount, true)
body[0].playcount, true)
.addField('**Country:**',
data.country, true)
body[0].country, true)
.addField('**Ranked Score:**',
data.ranked_score, true)
body[0].ranked_score, true)
.addField('**Total Score:**',
data.total_score, true)
body[0].total_score, true)
.addField('**SS:**',
data.count_rank_ss, true)
body[0].count_rank_ss, true)
.addField('**S:**',
data.count_rank_s, true)
body[0].count_rank_s, true)
.addField('**A:**',
data.count_rank_a, true);
body[0].count_rank_a, true);
return message.embed(embed);
} catch (err) {
return message.say('An Error Occurred. The user may not have been found.');
+8 -9
View File
@@ -26,22 +26,21 @@ module.exports = class SoundCloudCommand extends Command {
try {
const { body } = await request
.get(`https://api.soundcloud.com/tracks?q=${query}&client_id=${process.env.SOUNDCLOUD_KEY}`);
const data = body[0];
const embed = new RichEmbed()
.setColor(0xF15A22)
.setAuthor(data.title, 'http://icons.iconarchive.com/icons/danleech/simple/1024/soundcloud-icon.png')
.setURL(data.permalink_url)
.setThumbnail(data.artwork_url)
.setAuthor(body[0].title, 'http://icons.iconarchive.com/icons/danleech/simple/1024/soundcloud-icon.png')
.setURL(body[0].permalink_url)
.setThumbnail(body[0].artwork_url)
.addField('**Artist:**',
data.user.username)
body[0].user.username)
.addField('**Download Count:**',
data.download_count, true)
body[0].download_count, true)
.addField('**Comment Count**',
data.comment_count, true)
body[0].comment_count, true)
.addField('**Playback Count:**',
data.playback_count, true)
body[0].playback_count, true)
.addField('**Favorited Count:**',
data.favoritings_count, true);
body[0].favoritings_count, true);
return message.embed(embed);
} catch (err) {
return message.say('An Error Occurred. The song may not have been found.');
+7 -8
View File
@@ -10,7 +10,7 @@ module.exports = class UrbanCommand extends Command {
memberName: 'urban',
description: 'Searches Urban Dictionary for a word.',
args: [{
key: 'word',
key: 'query',
prompt: 'What would you like to define?',
type: 'string',
parse: text => encodeURIComponent(text)
@@ -22,19 +22,18 @@ module.exports = class UrbanCommand extends Command {
if (message.channel.type !== 'dm')
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
return message.say('This Command requires the `Embed Links` Permission.');
const { word } = args;
const { query } = args;
try {
const { body } = await request
.get(`http://api.urbandictionary.com/v0/define?term=${word}`);
const data = body.list[0];
.get(`http://api.urbandictionary.com/v0/define?term=${query}`);
const embed = new RichEmbed()
.setColor(0x32a8f0)
.setAuthor('Urban Dictionary', 'http://a1.mzstatic.com/eu/r30/Purple71/v4/66/54/68/6654683f-cacd-4a55-1784-f14257f77874/icon175x175.png')
.setURL(data.permalink)
.setTitle(data.word)
.setDescription(data.definition.substr(0, 2000))
.setURL(body.list[0].permalink)
.setTitle(body.list[0].word)
.setDescription(body.list[0].definition.substr(0, 2000))
.addField('**Example:**',
data.example.substr(0, 2000) || 'None');
body.list[0].example.substr(0, 2000) || 'None');
return message.embed(embed);
} catch (err) {
return message.say('An Error Occurred. The word may not have been found.');
+12 -13
View File
@@ -10,7 +10,7 @@ module.exports = class WattpadCommand extends Command {
memberName: 'wattpad',
description: 'Searches Wattpad for a book.',
args: [{
key: 'book',
key: 'query',
prompt: 'What book would you like to search for?',
type: 'string',
parse: text => encodeURIComponent(text)
@@ -22,32 +22,31 @@ module.exports = class WattpadCommand extends Command {
if (message.channel.type !== 'dm')
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
return message.say('This Command requires the `Embed Links` Permission.');
const { book } = args;
const { query } = args;
try {
const { body } = await request
.get(`https://api.wattpad.com:443/v4/stories?query=${book}&limit=1`)
.get(`https://api.wattpad.com:443/v4/stories?query=${query}&limit=1`)
.set({
'Authorization': `Basic ${process.env.WATTPAD_KEY}`
});
const data = body.stories[0];
const embed = new RichEmbed()
.setColor(0xF89C34)
.setAuthor('Wattpad', 'http://www.selfpubtoolbox.com/wp-content/uploads/2015/05/a6044fd3a88acd5043860484db972ca6.png')
.setURL(data.url)
.setTitle(data.title)
.setDescription(data.description.substr(0, 2000))
.setURL(body.stories[0].url)
.setTitle(body.stories[0].title)
.setDescription(body.stories[0].description.substr(0, 2000))
.addField('**Author:**',
data.user, true)
body.stories[0].user, true)
.addField('**Parts:**',
data.numParts, true)
body.stories[0].numParts, true)
.addField('**Created On:**',
data.createDate, true)
body.stories[0].createDate, true)
.addField('**Votes:**',
data.voteCount, true)
body.stories[0].voteCount, true)
.addField('**Reads:**',
data.readCount, true)
body.stories[0].readCount, true)
.addField('**Comments:**',
data.commentCount, true);
body.stories[0].commentCount, true);
return message.embed(embed);
} catch (err) {
return message.say('An Error Occurred. The book may not have been found.');
+17 -18
View File
@@ -10,7 +10,7 @@ module.exports = class WeatherCommand extends Command {
memberName: 'weather',
description: 'Gets weather information for a specified location.',
args: [{
key: 'location',
key: 'query',
prompt: 'What location would you like to get the current weather for?',
type: 'string'
}]
@@ -21,40 +21,39 @@ module.exports = class WeatherCommand extends Command {
if (message.channel.type !== 'dm')
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
return message.say('This Command requires the `Embed Links` Permission.');
const { location } = args;
const { query } = args;
try {
const { body } = await request
.get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${location}")&format=json`);
const data = body.query.results.channel;
.get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${query}")&format=json`);
const embed = new RichEmbed()
.setColor(0x0000FF)
.setAuthor(data.title, 'http://media.idownloadblog.com/wp-content/uploads/2013/12/yahoo-weather-213x220.png')
.setURL(data.link)
.setAuthor(body.query.results.channel.title, 'http://media.idownloadblog.com/wp-content/uploads/2013/12/yahoo-weather-213x220.png')
.setURL(body.query.results.channel.link)
.setTimestamp()
.addField('**City:**',
data.location.city, true)
body.query.results.channel.location.city, true)
.addField('**Country**',
data.location.country, true)
body.query.results.channel.location.country, true)
.addField('**Region:**',
data.location.region, true)
body.query.results.channel.location.region, true)
.addField('**Condition:**',
data.item.condition.text, true)
body.query.results.channel.item.condition.text, true)
.addField('**Temperature:**',
`${data.item.condition.temp}°F`, true)
`${body.query.results.channel.item.condition.temp}°F`, true)
.addField('**Humidity:**',
data.atmosphere.humidity, true)
body.query.results.channel.atmosphere.humidity, true)
.addField('**Pressure:**',
data.atmosphere.pressure, true)
body.query.results.channel.atmosphere.pressure, true)
.addField('**Rising:**',
data.atmosphere.rising, true)
body.query.results.channel.atmosphere.rising, true)
.addField('**Visibility:**',
data.atmosphere.visibility, true)
body.query.results.channel.atmosphere.visibility, true)
.addField('**Wind Chill:**',
data.wind.chill, true)
body.query.results.channel.wind.chill, true)
.addField('**Wind Direction:**',
data.wind.direction, true)
body.query.results.channel.wind.direction, true)
.addField('**Wind Speed:**',
data.wind.speed, true);
body.query.results.channel.wind.speed, true);
return message.embed(embed);
} catch (err) {
return message.say('An Error Occurred. The location may not have been found.');
+2 -4
View File
@@ -26,14 +26,12 @@ module.exports = class WikipediaCommand extends Command {
try {
const { body } = await request
.get(`https://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&titles=${query}&exintro=&explaintext=&redirects=&formatversion=2`);
const data = body.query.pages[0];
const description = data.extract.substr(0, 2000).split('\n').join('\n\n');
const embed = new RichEmbed()
.setColor(0xE7E7E7)
.setTitle(data.title)
.setTitle(body.query.pages[0].title)
.setURL(`https://en.wikipedia.org/wiki/${query}`)
.setAuthor('Wikipedia', 'https://upload.wikimedia.org/wikipedia/en/thumb/8/80/Wikipedia-logo-v2.svg/1122px-Wikipedia-logo-v2.svg.png')
.setDescription(description);
.setDescription(body.query.pages[0].extract.substr(0, 2000).split('\n').join('\n\n'));
return message.embed(embed);
} catch (err) {
return message.say('An Error Occurred. The page may not have been found.');
+8 -9
View File
@@ -10,7 +10,7 @@ module.exports = class YouTubeCommand extends Command {
memberName: 'youtube',
description: 'Searches YouTube for a video.',
args: [{
key: 'video',
key: 'query',
prompt: 'What would you like to search for?',
type: 'string',
parse: text => encodeURIComponent(text)
@@ -22,18 +22,17 @@ module.exports = class YouTubeCommand extends Command {
if (message.channel.type !== 'dm')
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
return message.say('This Command requires the `Embed Links` Permission.');
const { video } = args;
const { query } = args;
try {
const { body } = await request
.get(`https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&maxResults=1&q=${video}&key=${process.env.GOOGLE_KEY}`);
const data = body.items[0];
.get(`https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&maxResults=1&q=${query}&key=${process.env.GOOGLE_KEY}`);
const embed = new RichEmbed()
.setColor(0xDD2825)
.setTitle(data.snippet.title)
.setDescription(data.snippet.description)
.setAuthor(`YouTube - ${data.snippet.channelTitle}`, 'https://cdn3.iconfinder.com/data/icons/social-icons-5/607/YouTube_Play.png')
.setURL(`https://www.youtube.com/watch?v=${data.id.videoId}`)
.setThumbnail(data.snippet.thumbnails.default.url);
.setTitle(body.items[0].snippet.title)
.setDescription(body.items[0].snippet.description)
.setAuthor(`YouTube - ${body.items[0].snippet.channelTitle}`, 'https://cdn3.iconfinder.com/data/icons/social-icons-5/607/YouTube_Play.png')
.setURL(`https://www.youtube.com/watch?v=${body.items[0].id.videoId}`)
.setThumbnail(body.items[0].snippet.thumbnails.default.url);
return message.embed(embed);
} catch (err) {
return message.say('An Error Occurred. The video may not have been found.');
+14 -15
View File
@@ -10,7 +10,7 @@ module.exports = class YuGiOhCommand extends Command {
memberName: 'yugioh',
description: 'Gets info on a Yu-Gi-Oh! Card.',
args: [{
key: 'card',
key: 'query',
prompt: 'What card would you like to get data for?',
type: 'string',
parse: text => encodeURIComponent(text)
@@ -22,38 +22,37 @@ module.exports = class YuGiOhCommand extends Command {
if (message.channel.type !== 'dm')
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
return message.say('This Command requires the `Embed Links` Permission.');
const { card } = args;
const { query } = args;
try {
const { body } = await request
.get(`http://yugiohprices.com/api/card_data/${card}`);
const data = body.data;
if (data.card_type === 'monster') {
.get(`http://yugiohprices.com/api/card_data/${query}`);
if (body.data.card_type === 'monster') {
const embed = new RichEmbed()
.setColor(0xBE5F1F)
.setTitle(data.name)
.setDescription(data.text)
.setTitle(body.data.name)
.setDescription(body.data.text)
.setAuthor('Yu-Gi-Oh!', 'http://vignette3.wikia.nocookie.net/yugioh/images/1/10/Back-TF-EN-VG.png/revision/latest?cb=20120824043558')
.addField('**Card Type:**',
'Monster', true)
.addField('**Type:**',
data.type, true)
body.data.type, true)
.addField('**Attribute:**',
data.family, true)
body.data.family, true)
.addField('**ATK:**',
data.atk, true)
body.data.atk, true)
.addField('**DEF:**',
data.def, true)
body.data.def, true)
.addField('**Level:**',
data.level, true);
body.data.level, true);
return message.embed(embed);
}
const embed = new RichEmbed()
.setColor(0xBE5F1F)
.setTitle(data.name)
.setDescription(data.text)
.setTitle(body.data.name)
.setDescription(body.data.text)
.setAuthor('Yu-Gi-Oh!', 'http://vignette3.wikia.nocookie.net/yugioh/images/1/10/Back-TF-EN-VG.png/revision/latest?cb=20120824043558')
.addField('**Card Type:**',
data.card_type, true);
body.data.card_type, true);
return message.embed(embed);
} catch (err) {
return message.say('An Error Occurred. The card may not have been found.');
+4 -4
View File
@@ -1,5 +1,5 @@
const { Command } = require('discord.js-commando');
const stringToBinary = (str) => {
const binary = (str) => {
const pad = '00000000';
return unescape(encodeURIComponent(str))
.split('').map(str => {
@@ -19,12 +19,12 @@ module.exports = class BinaryCommand extends Command {
key: 'text',
prompt: 'What text would you like to convert to binary?',
type: 'string',
validate: content => {
if (stringToBinary(content).length < 2000)
validate: text => {
if (binary(text).length < 2000)
return true;
return 'Your message content is too long.';
},
parse: text => stringToBinary(text)
parse: text => binary(text)
}]
});
}
+1 -1
View File
@@ -22,7 +22,7 @@ module.exports = class EmbedCommand extends Command {
return message.say('This Command requires the `Embed Links` Permission.');
const { text } = args;
const embed = new RichEmbed()
.setAuthor(message.author.username, message.author.avatarURL)
.setAuthor(message.author.username, message.author.displayAvatarURL)
.setColor(0x00AE86)
.setTimestamp()
.setDescription(text);
+2 -2
View File
@@ -13,8 +13,8 @@ module.exports = class MorseCommand extends Command {
key: 'text',
prompt: 'What text would you like to convert to morse?',
type: 'string',
validate: content => {
if (letterTrans(content, dictionary, ' ').length < 1999)
validate: text => {
if (letterTrans(text, dictionary, ' ').length < 1999)
return true;
return 'Your message content is too long.';
},
+2 -2
View File
@@ -13,8 +13,8 @@ module.exports = class PirateCommand extends Command {
key: 'text',
prompt: 'What text would you like to convert to pirate?',
type: 'string',
validate: content => {
if (wordTrans(content, dictionary).length < 1999)
validate: text => {
if (wordTrans(text, dictionary).length < 1999)
return true;
return 'Your message content is too long.';
},
+2 -2
View File
@@ -13,8 +13,8 @@ module.exports = class TemmieCommand extends Command {
key: 'text',
prompt: 'What text would you like to convert to Temmie speak?',
type: 'string',
validate: content => {
if (wordTrans(content, dictionary).length < 1999)
validate: text => {
if (wordTrans(text, dictionary).length < 1999)
return true;
return 'Your message content is too long.';
},
+3 -3
View File
@@ -12,11 +12,11 @@ module.exports = class ZalgoCommand extends Command {
key: 'text',
prompt: 'What text would you like to convert to zalgo?',
type: 'string',
validate: content => {
if (content.length < 500) {
validate: text => {
if (text.length < 500) {
return true;
}
return `Please keep your text under 500 characters, you have ${content.length}.`;
return `Please keep your text under 500 characters, you have ${text.length}.`;
},
parse: text => zalgo(text)
}]
+7 -12
View File
@@ -15,7 +15,7 @@ module.exports = class ShardInfoCommand extends Command {
memberName: 'shardinfo',
description: 'Gives some bot info for the Shard you specify.',
args: [{
key: 'shardID',
key: 'shard',
prompt: 'Which Shard would you like to get data for?',
type: 'integer'
}]
@@ -26,26 +26,21 @@ module.exports = class ShardInfoCommand extends Command {
if (message.channel.type !== 'dm')
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
return message.say('This Command requires the `Embed Links` Permission.');
const { shardID } = args;
if (shardID > this.client.options.shardCount - 1 || shardID < 0)
const { shard } = args;
if (shard > this.client.options.shardCount - 1 || shard < 0)
return message.say('The Shard ID is not valid.');
const memory = await this.client.shard.broadcastEval('Math.round(process.memoryUsage().heapUsed / 1024 / 1024)');
const uptime = await this.client.shard.fetchClientValues('uptime');
const guilds = await this.client.shard.fetchClientValues('guilds.size');
const embed = new RichEmbed()
.setTitle(`Data for Shard ${shard}:`)
.setColor(0x00AE86)
.addField('Servers',
guilds[shardID], true)
.addField('Shard ID',
shardID, true)
guilds[shard], true)
.addField('Memory Usage',
`${memory[shardID]}MB`, true)
`${memory[shard]}MB`, true)
.addField('Uptime',
moment.duration(uptime[shardID]).format('d[d]h[h]m[m]s[s]'), true)
.addField('Version',
version, true)
.addField('Node Version',
process.version, true);
moment.duration(uptime[shard]).format('d[d]h[h]m[m]s[s]'), true);
return message.embed(embed);
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "16.4.2",
"version": "17.0.0",
"description": "A Discord Bot",
"main": "shardingmanager.js",
"scripts": {