summaryrefslogtreecommitdiff
path: root/server/src/commands/owner/Reload.ts
blob: ac7bd1f42acf40efcbe0520a0221792fc1b8c518 (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
39
40
import { Command } from 'discord-akairo';
import { Message } from 'discord.js';

export default class ReloadOwner extends Command {
    public constructor() {
        super('reload', {
            aliases: ['reload', 'reboot', 'reloadlistener'],
            category: 'owner',
            description: {
                content: 'Reload a command.',
                usage: '[command]',
                examples: [
                    'ping'
                ]
            },
            ratelimit: 3,
            args: [
                {
                    id: 'command',
                    type: 'string',
                    prompt: {
                        start: 'What command would you like to reload?',
                    },
                    match: 'rest'
                }
            ],
            ownerOnly: true
        });
    }
    
    public exec(msg: Message, { command }): Promise<Message> {
        if (msg.util.parsed.alias == 'reloadlistener') {
            this.client.listenerHandler.reload(command);
            return msg.channel.send(`Successfully reloaded the listener ${command}`);
        } else {
            this.handler.reload(command);
            return msg.channel.send(`Successfully reloaded the command ${command}`);
        }
    }
}