Merge branch 'djs' into 'dev'

djs command modification

See merge request engineering/communityrelations!12
merge-requests/12/merge
DedShot™#9195 2020-05-22 16:18:02 -04:00
commit d00db6fe79
1 changed files with 11 additions and 3 deletions

View File

@ -17,10 +17,18 @@ export default class DJS extends Command {
try {
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]}`);
if (!data) return this.error(message.channel, 'Could not find information. Try something else.');
let res: AxiosResponse<EmbedOptions>;
try {
res = await axios.get(`https://djsdocs.sorta.moe/v2/embed?src=master&q=${args[0]}`);
} catch (err) {
return this.error(message.channel, 'Please try again later, something unexpected happened.');
}
const embed = new RichEmbed(data);
if (!res.data) return this.error(message.channel, 'Could not find information. Try something else.');
const embed = new RichEmbed(res.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);