mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
A variety of fixes and a change in the way errors are handled.
This commit is contained in:
@@ -22,7 +22,7 @@ module.exports = class YearsCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES'))
|
||||
return message.say(':x: Error! I don\'t have the Attach Files Permission!');
|
||||
return message.say('This Command requires the `Attach Files` Permission.');
|
||||
const { user } = args;
|
||||
const userAvatar = user.displayAvatarURL.replace('.jpg', '.png').replace('.gif', '.png');
|
||||
let images = [];
|
||||
@@ -32,7 +32,7 @@ module.exports = class YearsCommand extends Command {
|
||||
avatar.resize(200, 200);
|
||||
years.blit(avatar, 461, 127);
|
||||
years.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if (err) return message.say(':x: Error! Something went wrong!');
|
||||
if (err) return message.say('An Unknown Error Occurred.');
|
||||
return message.channel.send({files: [{attachment: buff}]});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ module.exports = class BeautifulCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES'))
|
||||
return message.say(':x: Error! I don\'t have the Attach Files Permission!');
|
||||
return message.say('This Command requires the `Attach Files` Permission.');
|
||||
const { user } = args;
|
||||
const userAvatar = user.displayAvatarURL.replace('.jpg', '.png').replace('.gif', '.png');
|
||||
let images = [];
|
||||
@@ -34,7 +34,7 @@ module.exports = class BeautifulCommand extends Command {
|
||||
avatar.resize(190, 190);
|
||||
beautiful.blit(avatar, 451, 434);
|
||||
beautiful.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if (err) return message.say(':x: Error! Something went wrong!');
|
||||
if (err) return message.say('An Unknown Error Occurred.');
|
||||
return message.channel.send({files: [{attachment: buff}]});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ module.exports = class BobRossCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES'))
|
||||
return message.say(':x: Error! I don\'t have the Attach Files Permission!');
|
||||
return message.say('This Command requires the `Attach Files` Permission.');
|
||||
const { user } = args;
|
||||
const userAvatar = user.displayAvatarURL.replace('.jpg', '.png').replace('.gif', '.png');
|
||||
const blank = new Jimp(600, 775, 0xFFFFFF);
|
||||
@@ -35,7 +35,7 @@ module.exports = class BobRossCommand extends Command {
|
||||
blank.composite(avatar, 44, 85);
|
||||
blank.composite(bob, 0, 0);
|
||||
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if (err) return message.say(':x: Error! Something went wrong!');
|
||||
if (err) return message.say('An Unknown Error Occurred.');
|
||||
return message.channel.send({files: [{attachment: buff}]});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ module.exports = class RIPCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES'))
|
||||
return message.say(':x: Error! I don\'t have the Attach Files Permission!');
|
||||
return message.say('This Command requires the `Attach Files` Permission.');
|
||||
const { user } = args;
|
||||
const userAvatar = user.displayAvatarURL.replace('.jpg', '.png').replace('.gif', '.png');
|
||||
let images = [];
|
||||
@@ -33,7 +33,7 @@ module.exports = class RIPCommand extends Command {
|
||||
avatar.resize(200, 200);
|
||||
gravestone.blit(avatar, 158, 51);
|
||||
gravestone.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if (err) return message.say(':x: Error! Something went wrong!');
|
||||
if (err) return message.say('An Unknown Error Occurred.');
|
||||
return message.channel.send({files: [{attachment: buff}]});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ module.exports = class SteamCardCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES'))
|
||||
return message.say(':x: Error! I don\'t have the Attach Files Permission!');
|
||||
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('.jpg', '.png').replace('.gif', '.png');
|
||||
@@ -37,7 +37,7 @@ module.exports = class SteamCardCommand extends Command {
|
||||
blank.composite(steamcard, 0, 0);
|
||||
blank.print(font, 38, 20, username);
|
||||
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if (err) return message.say(':x: Error! Something went wrong!');
|
||||
if (err) return message.say('An Unknown Error Occurred.');
|
||||
return message.channel.send({files: [{attachment: buff}]});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ module.exports = class MathGameCommand extends Command {
|
||||
description: 'See how fast you can answer a math problem in a given time limit.',
|
||||
args: [{
|
||||
key: 'difficulty',
|
||||
prompt: 'What should the difficulty of the math game be? Easy, Medium, Hard, Extreme, or Impossible?',
|
||||
prompt: 'What should the difficulty of the math game be? `Easy`, `Medium`, `Hard`, `Extreme`, or `Impossible`?',
|
||||
type: 'string',
|
||||
validate: difficulty => {
|
||||
if (['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase()))
|
||||
@@ -27,7 +27,7 @@ module.exports = class MathGameCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { difficulty } = args;
|
||||
const operation = operations[Math.floor(Math.random() * operations.length)];
|
||||
let value;
|
||||
|
||||
@@ -18,7 +18,7 @@ module.exports = class QuizCommand extends Command {
|
||||
async run(message) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
try {
|
||||
const { body } = await request
|
||||
.get('http://jservice.io/api/random?count=1');
|
||||
|
||||
@@ -13,7 +13,7 @@ module.exports = class RockPaperScissorsCommand extends Command {
|
||||
description: 'Play Rock-Paper-Scissors.',
|
||||
args: [{
|
||||
key: 'choice',
|
||||
prompt: 'Rock, Paper, or Scissors?',
|
||||
prompt: '`Rock`, `Paper`, or `Scissors`?',
|
||||
type: 'string',
|
||||
validate: rps => {
|
||||
if (['rock', 'paper', 'scissors'].includes(rps.toLowerCase()))
|
||||
|
||||
@@ -11,7 +11,7 @@ module.exports = class TypingGameCommand extends Command {
|
||||
description: 'See how fast you can type a sentence in a given time limit.',
|
||||
args: [{
|
||||
key: 'difficulty',
|
||||
prompt: 'What should the difficulty of the typing game be? Easy, Medium, Hard, Extreme, or Impossible?',
|
||||
prompt: 'What should the difficulty of the typing game be? `Easy`, `Medium`, `Hard`, `Extreme`, or `Impossible`?',
|
||||
type: 'string',
|
||||
validate: difficulty => {
|
||||
if (['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase()))
|
||||
@@ -26,7 +26,7 @@ module.exports = class TypingGameCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { difficulty } = args;
|
||||
const sentence = sentences[Math.floor(Math.random() * sentences.length)];
|
||||
let time;
|
||||
|
||||
@@ -13,6 +13,6 @@ module.exports = class EmojiCommand extends Command {
|
||||
|
||||
run(message) {
|
||||
return message.say(message.guild.emojis.map(e => e).join(''))
|
||||
.catch(() => message.say(':x: Error! Perhaps you have no custom emoji?'));
|
||||
.catch(() => message.say('There was an error sending the emoji. Perhaps you have no custom emoji?'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = class GuildInfoCommand extends Command {
|
||||
|
||||
run(message) {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0x00AE86)
|
||||
.setThumbnail(message.guild.iconURL)
|
||||
|
||||
@@ -46,9 +46,9 @@ module.exports = class MemeCommand extends Command {
|
||||
run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES'))
|
||||
return message.say(':x: Error! I don\'t have the Attach Files Permission!');
|
||||
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`]})
|
||||
.catch(() => message.say(':x: Error! Something went wrong!'));
|
||||
.catch(() => message.say('An Unknown Error Occurred.'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -36,16 +36,21 @@ module.exports = class BanCommand extends Command {
|
||||
|
||||
async run(message, args) {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('BAN_MEMBERS'))
|
||||
return message.say(':x: Error! I don\'t have the Ban Members Permission!');
|
||||
return message.say('This Command requires the `Ban Members` Permission.');
|
||||
const modlogs = message.guild.channels.find('name', 'mod_logs');
|
||||
if (!modlogs)
|
||||
return message.say(':x: Error! Could not find the mod_logs channel! Please create it!');
|
||||
return message.say('This Command requires a channel named `mod_logs`.');
|
||||
if (!modlogs.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { member, reason } = args;
|
||||
if (!member.bannable)
|
||||
return message.say(':x: Error! This member cannot be banned! Perhaps they have a higher role than me?');
|
||||
return message.say('This member is not bannable. Perhaps they have a higher role than me?');
|
||||
try {
|
||||
try {
|
||||
await member.send(`You were banned from ${message.guild.name}!\nReason: ${reason}.`);
|
||||
} catch (err) {
|
||||
await message.say('Failed to send DM to user.');
|
||||
}
|
||||
await member.ban(7);
|
||||
await message.say(':ok_hand:');
|
||||
const embed = new RichEmbed()
|
||||
@@ -55,7 +60,7 @@ module.exports = class BanCommand extends Command {
|
||||
.setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Ban\n**Reason:** ${reason}`);
|
||||
return modlogs.send({embed});
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Something went wrong!');
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -32,17 +32,22 @@ module.exports = class KickCommand extends Command {
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('BAN_MEMBERS'))
|
||||
return message.say(':x: Error! I don\'t have the Ban Members Permission!');
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('KICK_MEMBERS'))
|
||||
return message.say('This Command requires the `Kick Members` Permission.');
|
||||
const modlogs = message.guild.channels.find('name', 'mod_logs');
|
||||
if (!modlogs)
|
||||
return message.say(':x: Error! Could not find the mod_logs channel! Please create it!');
|
||||
return message.say('This Command requires a channel named `mod_logs`.');
|
||||
if (!modlogs.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { member, reason } = args;
|
||||
if (!member.bannable)
|
||||
return message.say(':x: Error! This member cannot be kicked! Perhaps they have a higher role than me?');
|
||||
if (!member.kickable)
|
||||
return message.say('This member is not kickable. Perhaps they have a higher role than me?');
|
||||
try {
|
||||
try {
|
||||
await member.send(`You were kicked from ${message.guild.name}!\nReason: ${reason}.`);
|
||||
} catch (err) {
|
||||
await message.say('Failed to send DM.');
|
||||
}
|
||||
await member.kick();
|
||||
await message.say(':ok_hand:');
|
||||
const embed = new RichEmbed()
|
||||
@@ -52,7 +57,7 @@ module.exports = class KickCommand extends Command {
|
||||
.setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Kick\n**Reason:** ${reason}`);
|
||||
return modlogs.send({embed});
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Something went wrong!');
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,11 +6,11 @@ module.exports = class LockdownCommand extends Command {
|
||||
name: 'lockdown',
|
||||
group: 'moderation',
|
||||
memberName: 'lockdown',
|
||||
description: 'Locks down the current channel or removes a lockdown, which prevents non-roled members from speaking.',
|
||||
description: 'Locks down the current channel or removes a lockdown, which prevents non-administrator members from speaking.',
|
||||
guildOnly: true,
|
||||
args: [{
|
||||
key: 'type',
|
||||
prompt: 'Please enter either start or stop.',
|
||||
prompt: 'Please enter either `start` or `stop`.',
|
||||
type: 'string',
|
||||
validate: type => {
|
||||
if (['start', 'stop'].includes(type.toLowerCase()))
|
||||
@@ -28,25 +28,25 @@ module.exports = class LockdownCommand extends Command {
|
||||
|
||||
async run(message, args) {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ADMINISTRATOR'))
|
||||
return message.say(':x: Error! I don\'t have the Administrator Permission!');
|
||||
return message.say('This Command requires the `Administrator` Permission.');
|
||||
const { type } = args;
|
||||
if (type === 'start') {
|
||||
try {
|
||||
await message.channel.overwritePermissions(message.guild.defaultRole, {
|
||||
SEND_MESSAGES: false
|
||||
});
|
||||
return message.say('**Lockdown Started, users without Administrator can no longer post messages. Please use `;lockdown stop` to end the lockdown.**');
|
||||
return message.say('Lockdown Started, users without Administrator can no longer post messages. Please use `;lockdown stop` to end the lockdown.');
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Something went wrong!');
|
||||
return message.say('Something went wrong!');
|
||||
}
|
||||
} else if (type === 'stop') {
|
||||
try {
|
||||
await message.channel.overwritePermissions(message.guild.defaultRole, {
|
||||
SEND_MESSAGES: true
|
||||
});
|
||||
return message.say('**Lockdown Ended, users without Administrator can now post messages.**');
|
||||
return message.say('Lockdown Ended, users without Administrator can now post messages.');
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Something went wrong!');
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +31,9 @@ module.exports = class PruneCommand extends Command {
|
||||
|
||||
async run(message, args) {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGE_HISTORY'))
|
||||
return message.say(':x: Error! I don\'t have the Read Message History Permission!');
|
||||
return message.say('This Command requires the `Read Message History` Permission.');
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('MANAGE_MESSAGES'))
|
||||
return message.say(':x: Error! I don\'t have the Manage Messages Permission!');
|
||||
return message.say('This Command requires the `Manage Messages` Permission.');
|
||||
let { count } = args;
|
||||
count = count + 1;
|
||||
try {
|
||||
@@ -43,7 +43,7 @@ module.exports = class PruneCommand extends Command {
|
||||
await message.channel.bulkDelete(messages, true);
|
||||
return null;
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Something went wrong! Perhaps there are not enough messages in the channel from earlier than two weeks?');
|
||||
return message.say('There are no messages younger than two weeks that can be deleted.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -40,16 +40,16 @@ module.exports = class UnbanCommand extends Command {
|
||||
|
||||
async run(message, args) {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('BAN_MEMBERS'))
|
||||
return message.say(':x: Error! I don\'t have the Ban Members Permission!');
|
||||
return message.say('This Command requires the `Ban Members` Permission.');
|
||||
const modlogs = message.guild.channels.find('name', 'mod_logs');
|
||||
if (!modlogs)
|
||||
return message.say(':x: Error! Could not find the mod_logs channel! Please create it!');
|
||||
return message.say('This Command requires a channel named `mod_logs`.');
|
||||
if (!modlogs.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { memberID, reason } = args;
|
||||
const bans = await message.guild.fetchBans();
|
||||
if (!bans.has(memberID))
|
||||
return message.say(':x: Error! Could not find this user in the bans.');
|
||||
return message.say('This ID is not in the Guild Banlist.');
|
||||
const unbanUser = await bans.get(memberID);
|
||||
try {
|
||||
await message.guild.unban(unbanUser);
|
||||
@@ -61,7 +61,7 @@ module.exports = class UnbanCommand extends Command {
|
||||
.setDescription(`**Member:** ${unbanUser.tag} (${unbanUser.id})\n**Action:** Unban\n**Reason:** ${reason}`);
|
||||
return modlogs.send({embed});
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Something went wrong!');
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -31,13 +31,11 @@ module.exports = class WarnCommand extends Command {
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('BAN_MEMBERS'))
|
||||
return message.say(':x: Error! I don\'t have the Ban Members Permission!');
|
||||
const modlogs = message.guild.channels.find('name', 'mod_logs');
|
||||
if (!modlogs)
|
||||
return message.say(':x: Error! Could not find the mod_logs channel! Please create it!');
|
||||
return message.say('This Command requires a channel named `mod_logs`.');
|
||||
if (!modlogs.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { member, reason } = args;
|
||||
try {
|
||||
await message.say(':ok_hand:');
|
||||
@@ -48,7 +46,7 @@ module.exports = class WarnCommand extends Command {
|
||||
.setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Warn\n**Reason:** ${reason}`);
|
||||
return modlogs.send({embed});
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Something went wrong!');
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,9 +21,9 @@ module.exports = class MathCommand extends Command {
|
||||
try {
|
||||
const solved = math.eval(expression);
|
||||
return message.say(solved)
|
||||
.catch(() => message.say(':x: Error! Invalid statement!'));
|
||||
.catch(() => message.say('Invalid statement.'));
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Invalid statement!');
|
||||
return message.say('Invalid statement.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@ module.exports = class NitroCommand extends Command {
|
||||
run(message) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor('Discord Nitro')
|
||||
.setThumbnail('https://pbs.twimg.com/profile_images/814184180649197568/y2eZcVMq.jpg')
|
||||
|
||||
@@ -13,7 +13,7 @@ module.exports = class SpamCommand extends Command {
|
||||
run(message) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES'))
|
||||
return message.say(':x: Error! I don\'t have the Attach Files Permission!');
|
||||
return message.say('This Command requires the `Attach Files` Permission.');
|
||||
return message.channel.send({files: ['./images/Spam.jpg']});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -34,9 +34,9 @@ module.exports = class StrawpollCommand extends Command {
|
||||
async run(message, args) {
|
||||
const { title, choices } = args;
|
||||
if (choices.length < 2)
|
||||
return message.say(':x: Error! You provided less than two choices!');
|
||||
return message.say('You provided less than two choices.');
|
||||
if (choices.length > 31)
|
||||
return message.say(':x: Error! You provided more than thirty choices!');
|
||||
return message.say('You provided more than thirty choices.');
|
||||
try {
|
||||
const { body } = await request
|
||||
.post('https://strawpoll.me/api/v2/polls')
|
||||
@@ -47,7 +47,7 @@ module.exports = class StrawpollCommand extends Command {
|
||||
return message.say(`${body.title}\nhttp://strawpoll.me/${body.id}`);
|
||||
}
|
||||
catch (err) {
|
||||
return message.say(':x: Error! Something went wrong!');
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = class TodayCommand extends Command {
|
||||
async run(message) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
try {
|
||||
const { text } = await request
|
||||
.get('http://history.muffinlabs.com/date')
|
||||
@@ -31,7 +31,7 @@ module.exports = class TodayCommand extends Command {
|
||||
.setDescription(`${events[randomNumber].text} (${events[randomNumber].year})`);
|
||||
return message.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Something went wrong!');
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@ module.exports = class WouldYouRatherCommand extends Command {
|
||||
async run(message) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
try {
|
||||
const { body } = await request
|
||||
.get('http://www.rrrather.com/botapi');
|
||||
@@ -29,7 +29,7 @@ module.exports = class WouldYouRatherCommand extends Command {
|
||||
.setDescription(`${body.choicea} OR ${body.choiceb}?`);
|
||||
return message.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Something went wrong!');
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ module.exports = class CatCommand extends Command {
|
||||
run(message) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES'))
|
||||
return message.say(':x: Error! I don\'t have the Attach Files Permission!');
|
||||
return message.say('This Command requires the `Attach Files` Permission.');
|
||||
const cat = cats[Math.floor(Math.random() * cats.length)];
|
||||
return message.channel.send({files: [`./images/Cat${cat}`]});
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ module.exports = class PotatoCommand extends Command {
|
||||
run(message) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES'))
|
||||
return message.say(':x: Error! I don\'t have the Attach Files Permission!');
|
||||
return message.say('This Command requires the `Attach Files` Permission.');
|
||||
const potato = potatoes[Math.floor(Math.random() * potatoes.length)];
|
||||
return message.channel.send({files: [`./images/Potato${potato}`]});
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ module.exports = class RandomPunCommand extends Command {
|
||||
run(message) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES'))
|
||||
return message.say(':x: Error! I don\'t have the Attach Files Permission!');
|
||||
return message.say('This Command requires the `Attach Files` Permission.');
|
||||
const pun = puns[Math.floor(Math.random() * puns.length)];
|
||||
return message.channel.send({files: [`./images/Pun${pun}`]});
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ module.exports = class XiaoCommand extends Command {
|
||||
run(message) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES'))
|
||||
return message.say(':x: Error! I don\'t have the Attach Files Permission!');
|
||||
return message.say('This Command requires the `Attach Files` Permission.');
|
||||
const xiao = xiaos[Math.floor(Math.random() * xiaos.length)];
|
||||
return message.channel.send({files: [`./images/Xiao${xiao}`]});
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ module.exports = class BotSearchCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
let { bot } = args;
|
||||
bot = bot.id;
|
||||
try {
|
||||
@@ -43,7 +43,7 @@ module.exports = class BotSearchCommand extends Command {
|
||||
body.prefix, true);
|
||||
return message.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Bot not Found!');
|
||||
return message.say('An Error Occurred. The bot may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = class DefineCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { word } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -33,7 +33,7 @@ module.exports = class DefineCommand extends Command {
|
||||
.setDescription(data.text);
|
||||
return message.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Word not Found!');
|
||||
return message.say('An Error Occurred. The word may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ module.exports = class DiscrimCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { discrim } = args;
|
||||
const users = await this.client.users.filter(u => u.discriminator === discrim).map(u => u.username).sort();
|
||||
const embed = new RichEmbed()
|
||||
|
||||
@@ -20,7 +20,7 @@ module.exports = class ForecastCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { location } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -48,7 +48,7 @@ module.exports = class ForecastCommand extends Command {
|
||||
`**High:** ${data[6].high}°F, **Low:** ${data[6].low}°F, **Condition:** ${data[6].text}`);
|
||||
return message.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Make sure you typed the location correctly!');
|
||||
return message.say('An Error Occurred. The location may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -31,7 +31,7 @@ module.exports = class GoogleCommand extends Command {
|
||||
href = querystring.parse(href.replace('/url?', ''));
|
||||
return msg.edit(href.q);
|
||||
} catch (err) {
|
||||
return msg.edit(':x: Error! No Results Found!');
|
||||
return msg.edit('No Results Found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = class IMDBCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { movie } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -48,7 +48,7 @@ module.exports = class IMDBCommand extends Command {
|
||||
body.Actors);
|
||||
return message.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Movie not found!');
|
||||
return message.say('An Error Occurred. The film may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -29,14 +29,14 @@ module.exports = class MapCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES'))
|
||||
return message.say(':x: Error! I don\'t have the Attach Files Permission!');
|
||||
return message.say('This Command requires the `Attach Files` Permission.');
|
||||
const { zoom, location } = 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}`);
|
||||
return message.channel.send({files: [{attachment: body}]});
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Something went wrong! Make sure you entered the location correctly!');
|
||||
return message.say('An Error Occurred. The location may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -19,9 +19,6 @@ module.exports = class NeopetCommand extends Command {
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES'))
|
||||
return message.say(':x: Error! I don\'t have the Attach Files Permission!');
|
||||
const { pet } = args;
|
||||
try {
|
||||
const { text } = await request
|
||||
@@ -29,10 +26,10 @@ module.exports = class NeopetCommand extends Command {
|
||||
const $ = cheerio.load(text);
|
||||
const link = $('textarea').first().text();
|
||||
if (!link.includes('cp'))
|
||||
return message.say(':x: Error! Pet not found!');
|
||||
return message.say('This is not a valid pet name.');
|
||||
return message.say(link);
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Something went wrong!');
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = class OsuCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { username } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -57,7 +57,7 @@ module.exports = class OsuCommand extends Command {
|
||||
data.count_rank_a, true);
|
||||
return message.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! User not Found!');
|
||||
return message.say('An Error Occurred. The user may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = class SoundCloudCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -44,7 +44,7 @@ module.exports = class SoundCloudCommand extends Command {
|
||||
data.favoritings_count, true);
|
||||
return message.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! No Results Found!');
|
||||
return message.say('An Error Occurred. The song may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = class UrbanCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { word } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -37,7 +37,7 @@ module.exports = class UrbanCommand extends Command {
|
||||
data.example.substr(0, 2000) || 'None');
|
||||
return message.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Word not found!');
|
||||
return message.say('An Error Occurred. The word may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = class WattpadCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { book } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -50,7 +50,7 @@ module.exports = class WattpadCommand extends Command {
|
||||
data.commentCount, true);
|
||||
return message.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Book not Found!');
|
||||
return message.say('An Error Occurred. The book may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ module.exports = class WeatherCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { location } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -57,7 +57,7 @@ module.exports = class WeatherCommand extends Command {
|
||||
data.wind.speed, true);
|
||||
return message.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Make sure you typed the location correctly!');
|
||||
return message.say('An Error Occurred. The location may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = class WikipediaCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -36,7 +36,7 @@ module.exports = class WikipediaCommand extends Command {
|
||||
.setDescription(description);
|
||||
return message.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Entry Not Found!');
|
||||
return message.say('An Error Occurred. The page may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = class YouTubeCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { video } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -36,7 +36,7 @@ module.exports = class YouTubeCommand extends Command {
|
||||
.setThumbnail(data.snippet.thumbnails.default.url);
|
||||
return message.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Something went wrong! Maybe no video was found?');
|
||||
return message.say('An Error Occurred. The video may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = class YuGiOhCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { card } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -56,7 +56,7 @@ module.exports = class YuGiOhCommand extends Command {
|
||||
data.card_type, true);
|
||||
return message.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Card not Found!\n:notepad_spiral: Note: This command is **extremely** sensitive to casing and dashes and whatnot. Type the *exact* card name to get data!');
|
||||
return message.say('An Error Occurred. The card may not have been found.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -19,7 +19,7 @@ module.exports = class EmbedCommand extends Command {
|
||||
run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { text } = args;
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(message.author.username, message.author.avatarURL)
|
||||
|
||||
@@ -12,6 +12,7 @@ module.exports = class SayCommand extends Command {
|
||||
group: 'textedit',
|
||||
memberName: 'say',
|
||||
description: 'Make XiaoBot say what you wish.',
|
||||
guildOnly: true,
|
||||
args: [{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like XiaoBot to say?',
|
||||
@@ -21,7 +22,10 @@ module.exports = class SayCommand extends Command {
|
||||
}
|
||||
|
||||
run(message, args) {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('MANAGE_MESSAGES'))
|
||||
return message.say('This Command requires the `Manage Messages` Permission.');
|
||||
const { text } = args;
|
||||
message.delete();
|
||||
return message.say(`\u180E${text}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ module.exports = class WebhookCommand extends Command {
|
||||
|
||||
async run(message, args) {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('MANAGE_MESSAGES'))
|
||||
return message.say(':x: Error! I don\'t have the Manage Messages Permission!');
|
||||
return message.say('This Command requires the `Manage Messages` Permission.');
|
||||
const { text } = args;
|
||||
try {
|
||||
message.delete();
|
||||
@@ -38,7 +38,7 @@ module.exports = class WebhookCommand extends Command {
|
||||
});
|
||||
return null;
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Message failed to send!');
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ module.exports = class UserInfoCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { user } = args;
|
||||
const member = await message.guild.fetchMember(user);
|
||||
let stat;
|
||||
|
||||
@@ -20,7 +20,7 @@ module.exports = class InfoCommand extends Command {
|
||||
async run(message) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const guilds = await this.client.shard.fetchClientValues('guilds.size');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0x00AE86)
|
||||
|
||||
@@ -25,10 +25,10 @@ module.exports = class ShardInfoCommand extends Command {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS'))
|
||||
return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { shardID } = args;
|
||||
if (shardID > this.client.options.shardCount - 1 || shardID < 0)
|
||||
return message.say(':x: Error! Invalid Shard!');
|
||||
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');
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "15.3.19",
|
||||
"version": "15.3.20",
|
||||
"description": "A Discord Bot",
|
||||
"main": "shardingmanager.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user