summaryrefslogtreecommitdiff
path: root/server/src/commands/mod/Unban.ts
blob: 7e66af100c0f29560d61654c7a35c99979d87632 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { Command } from 'discord-akairo';
import { Message } from 'discord.js';

export default class UnbanMod extends Command {
    public constructor() {
        super('unban', {
            aliases: ['unban'],
            category: 'moderation',
            description: {
                content: 'Unban a specified user from the server.',
                usage: '[user id]',
                examples: [
                    '50'
                ]
            },
            ratelimit: 3,
            channel: 'guild',
            clientPermissions: ['BAN_MEMBERS'],
            userPermissions: ['BAN_MEMBERS'],
            args: [
                {
                    id: 'user',
                    type: 'integer',
                    prompt: {
                        start: 'Which user would you like to unban?',
                        retry: 'That doesn\' seem to be a user ID, please try again!'
                    }
                }
            ]
        });
    }
    
    public exec(msg: Message, { user }): Promise<Message> {
        return msg.guild.members.unban(user.toString()) // Does this really need to be returned?
            .then(() => { return msg.reply(`User ID ${user} was successfully unbanned!`)})
            .catch(() => { return msg.reply('Could not unban the specified user, are they banned in the first place?')});
    }
}