fix unban issue
parent
3b12b26026
commit
506deee8ab
|
@ -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;
|
||||||
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.***`);
|
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.***`);
|
if (!user) return message.channel.createMessage(`***${this.client.util.emojis.ERROR} Unable to locate user.***`);
|
||||||
message.delete();
|
message.delete();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue