used await instead of .then().catch() (KhaaZ)
parent
c1fe2de75a
commit
da7d68d7fb
|
@ -17,8 +17,13 @@ export default class DJS extends Command {
|
|||
try {
|
||||
if (!args[0]) return this.client.commands.get('help').run(message, [this.name]);
|
||||
|
||||
return axios.get(`https://djsdocs.sorta.moe/v2/embed?src=master&q=${args[0]}`)
|
||||
.then((res) => {
|
||||
let res;
|
||||
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 } = res;
|
||||
if (!data) return this.error(message.channel, 'Could not find information. Try something else.');
|
||||
|
||||
|
@ -41,11 +46,6 @@ export default class DJS extends Command {
|
|||
embed.setFooter(this.client.user.username, this.client.user.avatarURL);
|
||||
embed.setTimestamp();
|
||||
return message.channel.createMessage({ embed });
|
||||
})
|
||||
.catch((err) => {
|
||||
this.error(message.channel, 'Please try again later, something unexpected happened.');
|
||||
this.client.util.handleError(err, message, this);
|
||||
});
|
||||
} catch (err) {
|
||||
return this.client.util.handleError(err, message, this);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue