add unban cmd
parent
a6ba25801a
commit
1e5bcc56c0
|
@ -0,0 +1,29 @@
|
||||||
|
import { Message } from 'eris';
|
||||||
|
import { Client, Command } from '../class';
|
||||||
|
|
||||||
|
export default class Unban extends Command {
|
||||||
|
constructor(client: Client) {
|
||||||
|
super(client);
|
||||||
|
this.name = 'unban';
|
||||||
|
this.description = 'Unbans a member from the guild.';
|
||||||
|
this.usage = 'unban <user id> [reason]';
|
||||||
|
this.permissions = 2;
|
||||||
|
this.guildOnly = true;
|
||||||
|
this.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
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.***`);
|
||||||
|
if (!user) return message.channel.createMessage(`***${this.client.util.emojis.ERROR} Unable to locate user.***`);
|
||||||
|
message.delete();
|
||||||
|
|
||||||
|
await this.client.util.moderation.unban(user.id, message.member, args.slice(1).join(' '));
|
||||||
|
return message.channel.createMessage(`***${this.client.util.emojis.SUCCESS} ${user.username}#${user.discriminator} has been unbanned.***`);
|
||||||
|
} catch (err) {
|
||||||
|
return this.client.util.handleError(err, message, this, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue