From 506deee8aba5cab8737924cdcb7e7d6ca0f634a1 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Thu, 16 Apr 2020 10:14:13 -0400 Subject: [PATCH] fix unban issue --- src/commands/unban.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/commands/unban.ts b/src/commands/unban.ts index 5e46dab..2d1702e 100644 --- a/src/commands/unban.ts +++ b/src/commands/unban.ts @@ -1,4 +1,4 @@ -import { Message } from 'eris'; +import { Message, User } from 'eris'; import { Client, Command } from '../class'; export default class Unban extends Command { @@ -15,8 +15,17 @@ export default class Unban extends Command { public async run(message: Message, args: string[]) { try { // @ts-ignore - const user = await this.client.getRESTUser(args[0]); - if (await this.client.getRESTGuildMember(this.client.config.guildID, args[0])) return message.channel.createMessage(`***${this.client.util.emojis.ERROR} This member exists in the server.***`); + let user: User; + try { + await this.client.getRESTUser(args[0]); + } catch { + return message.channel.createMessage(`***${this.client.util.emojis.ERROR} Could find find user.***`); + } + try { + if (await this.client.getRESTGuildMember(this.client.config.guildID, args[0])) return message.channel.createMessage(`***${this.client.util.emojis.ERROR} This member exists in the server.***`); + } catch { + return message.channel.createMessage(`***${this.client.util.emojis.ERROR} This member exists in the server.***`); + } if (!user) return message.channel.createMessage(`***${this.client.util.emojis.ERROR} Unable to locate user.***`); message.delete();