A variety of fixes and a change in the way errors are handled.

This commit is contained in:
Daniel Odendahl Jr
2017-04-25 17:37:01 +00:00
parent d3dad31c6d
commit 49d092d7c1
51 changed files with 117 additions and 108 deletions
+2 -2
View File
@@ -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.');
}
}
};
+1 -1
View File
@@ -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')
+1 -1
View File
@@ -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']});
}
};
+3 -3
View File
@@ -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.');
}
}
};
+2 -2
View File
@@ -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.');
}
}
};
+2 -2
View File
@@ -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.');
}
}
};