fixing djs command
parent
9e88445bbf
commit
721262f7d3
|
@ -17,10 +17,20 @@ export default class DJS extends Command {
|
||||||
try {
|
try {
|
||||||
if (!args[0]) return this.client.commands.get('help').run(message, [this.name]);
|
if (!args[0]) return this.client.commands.get('help').run(message, [this.name]);
|
||||||
|
|
||||||
const { data }: AxiosResponse<EmbedOptions> = await axios.get(`https://djsdocs.sorta.moe/v2/embed?src=master&q=${args[0]}`);
|
let res: AxiosResponse<any>;
|
||||||
|
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<EmbedOptions> = res;
|
||||||
if (!data) return this.error(message.channel, 'Could not find information. Try something else.');
|
if (!data) return this.error(message.channel, 'Could not find information. Try something else.');
|
||||||
|
|
||||||
const embed = new RichEmbed(data);
|
const embed = new RichEmbed(data);
|
||||||
|
embed.setFooter(this.client.user.username, this.client.user.avatarURL);
|
||||||
|
embed.setTimestamp();
|
||||||
return message.channel.createMessage({ embed });
|
return message.channel.createMessage({ embed });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return this.client.util.handleError(err, message, this);
|
return this.client.util.handleError(err, message, this);
|
||||||
|
|
Loading…
Reference in New Issue