summaryrefslogtreecommitdiff
path: root/server/src/commands/owner/LeaveServer.ts
blob: 7785adae1d4fd2b21c144794c2ef50cb56f2667b (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
import { Command } from 'discord-akairo';
import { Message } from 'discord.js';
import request from 'node-superfetch';

export default class LeaveServerOwner extends Command {
    public constructor() {
        super('leaveserver', {
            aliases: ['leaveserver'],
            category: 'owner',
            description: {
                content: 'The bot will leave a specified server.',
                usage: '[id]',
                examples: [
                    '123456789012345678'
                ]
            },
            ratelimit: 3,
            ownerOnly: true,
            args: [
                {
                    id: "serverId",
                    prompt: {
                        start: "What server would you like to leave?",
                        optional: false
                    },
                    type: "string"
                }
            ]
        });
    }
    
    public async exec(msg: Message, { serverId }): Promise<Message> {
        this.client.guilds.cache.get(serverId).leave().catch(error => {
            console.log(error);
            return msg.reply("Woops, there was an error leaving that server.");
        });
        return msg.reply(`Successfully left a server with the ID of ${serverId}.`)
    }
}