mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 22:32:50 +02:00
Bug Catching in File Commands
This commit is contained in:
@@ -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.');
|
||||
}
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
|
||||
@@ -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.'));
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user