wrap all commands in try/catch block

merge-requests/1/merge
Matthew 2020-04-14 21:33:47 -04:00
parent bc72e484f8
commit b194c7e097
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
2 changed files with 79 additions and 71 deletions

View File

@ -11,8 +11,12 @@ export default class Ping extends Command {
}
public async run(message: Message) {
try {
const clientStart: number = Date.now();
const msg: Message = await message.channel.createMessage('🏓 Pong!');
msg.edit(`🏓 Pong!\nClient: \`${Date.now() - clientStart}ms\`\nResponse: \`${msg.createdAt - message.createdAt}ms\``);
} catch (err) {
this.client.util.handleError(err, message, this);
}
}
}

View File

@ -16,6 +16,7 @@ export default class Whois extends Command {
}
public async run(message: Message, args: string[]) {
try {
let member: Member;
if (!args[0]) member = message.member;
else {
@ -88,6 +89,9 @@ export default class Whois extends Command {
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);
}
}
public resolveStaffInformation(id: string) {