From 721262f7d37989b26f1d4add27dcbb33fcd35149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?DedShot=E2=84=A2=239195?= Date: Mon, 18 May 2020 23:38:53 -0400 Subject: [PATCH] fixing djs command --- src/commands/djs.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/commands/djs.ts b/src/commands/djs.ts index 224150a..44e6367 100644 --- a/src/commands/djs.ts +++ b/src/commands/djs.ts @@ -17,10 +17,20 @@ export default class DJS extends Command { try { if (!args[0]) return this.client.commands.get('help').run(message, [this.name]); - const { data }: AxiosResponse = await axios.get(`https://djsdocs.sorta.moe/v2/embed?src=master&q=${args[0]}`); + let res: AxiosResponse; + try { + res = await axios.get(`https://djsdocs.sorta.moe/v2/embed?src=master&q=${args[0]}`); + } catch (err) { + this.error(message.channel, 'Please try again later, something unexpected happened.'); + return this.client.util.handleError(err, message, this); + } + + const { data }: AxiosResponse = res; if (!data) return this.error(message.channel, 'Could not find information. Try something else.'); const embed = new RichEmbed(data); + embed.setFooter(this.client.user.username, this.client.user.avatarURL); + embed.setTimestamp(); return message.channel.createMessage({ embed }); } catch (err) { return this.client.util.handleError(err, message, this);