1
0
Fork 0

Error handler

refactor/models
Bsian 2019-11-21 14:42:05 +00:00
parent 3156fe58e9
commit 5a3520aa4b
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 33 additions and 29 deletions

View File

@ -16,6 +16,7 @@ export default class Whois_User extends Command {
} }
public async run(message: Message, args: string[]) { public async run(message: Message, args: string[]) {
try {
let account: AccountInterface; let account: AccountInterface;
if (!args[0]) account = await this.client.db.Account.findOne({ userID: message.author.id }); if (!args[0]) account = await this.client.db.Account.findOne({ userID: message.author.id });
else account = await this.client.db.Account.findOne({ $or: [{ username: args[0] }, { userID: args[0] }] }); else account = await this.client.db.Account.findOne({ $or: [{ username: args[0] }, { userID: args[0] }] });
@ -45,5 +46,8 @@ export default class Whois_User extends Command {
embed.setTimestamp(); embed.setTimestamp();
// @ts-ignore // @ts-ignore
message.channel.createMessage({ embed }); message.channel.createMessage({ embed });
} catch (error) {
this.client.util.handleError(error, message, this);
}
} }
} }