wrap all commands in try/catch block
parent
bc72e484f8
commit
b194c7e097
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue