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
+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.');
}
}
};