Bug Catching in File Commands

This commit is contained in:
Daniel Odendahl Jr
2017-05-02 11:18:51 +00:00
parent 4fd695c655
commit a9d29cdec4
15 changed files with 29 additions and 15 deletions
+2 -1
View File
@@ -21,7 +21,8 @@ module.exports = class CatCommand extends Command {
try {
const { body } = await request
.get('http://random.cat/meow');
return msg.channel.send({files: [body.file]});
return msg.channel.send({files: [body.file]})
.catch(() => msg.say('An Unknown Error Occurred.'));
} catch (err) {
return msg.say('An Unknown Error Occurred.');
}
+2 -1
View File
@@ -18,7 +18,8 @@ module.exports = class DogCommand extends Command {
try {
const { body } = await request
.get('https://random.dog/woof.json');
return msg.channel.send({files: [body.url]});
return msg.channel.send({files: [body.url]})
.catch(() => msg.say('An Unknown Error Occurred.'));
} catch (err) {
return msg.say('An Unknown Error Occurred.');
}
+2 -1
View File
@@ -19,6 +19,7 @@ module.exports = class XiaoCommand extends Command {
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
return msg.say('This Command requires the `Attach Files` Permission.');
const xiao = xiaos[Math.floor(Math.random() * xiaos.length)];
return msg.channel.send({files: [xiao]});
return msg.channel.send({files: [xiao]})
.catch(() => msg.say('An Unknown Error Occurred.'));
}
};