mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-22 01:57:54 +02:00
A variety of fixes and a change in the way errors are handled.
This commit is contained in:
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user