fix unban issue

merge-requests/9/merge
Matthew 2020-04-16 10:14:13 -04:00
parent 3b12b26026
commit 506deee8ab
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 12 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import { Message } from 'eris'; import { Message, User } from 'eris';
import { Client, Command } from '../class'; import { Client, Command } from '../class';
export default class Unban extends Command { export default class Unban extends Command {
@ -15,8 +15,17 @@ export default class Unban extends Command {
public async run(message: Message, args: string[]) { public async run(message: Message, args: string[]) {
try { try {
// @ts-ignore // @ts-ignore
const user = await this.client.getRESTUser(args[0]); 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.***`); 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.***`); if (!user) return message.channel.createMessage(`***${this.client.util.emojis.ERROR} Unable to locate user.***`);
message.delete(); message.delete();