Catch every API

This commit is contained in:
Daniel Odendahl Jr
2017-08-27 22:04:58 +00:00
parent 75422711c3
commit eed39c5ec1
63 changed files with 785 additions and 631 deletions
+8 -4
View File
@@ -24,9 +24,13 @@ module.exports = class WebhookCommand extends Command {
async run(msg, args) {
const { content } = args;
if (msg.guild && msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES')) await msg.delete();
await snekfetch
.post(WEBHOOK_URL)
.send({ content });
return null;
try {
await snekfetch
.post(WEBHOOK_URL)
.send({ content });
return null;
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};