summaryrefslogtreecommitdiff
path: root/server/src/commands/fun/Say.ts
blob: 1fcd4da68b3862d8b393f8fe4365fe66d97ca1bc (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
41
42
import { Command } from 'discord-akairo';
import { Message } from 'discord.js';
import { validIDs, owners } from '../../Config';

export default class SayFun extends Command {
    public constructor() {
        super('say', {
            aliases: ['say'],
            category: 'fun',
            description: {
                content: 'Allows you to speak as the bot.',
                usage: '[text]',
                examples: [
                    'hi this is bot'
                ]
            },
            ratelimit: 3,
            args: [
                {
                    id: 'text',
                    type: 'string',
                    prompt: {
                        start: 'What would you like to say?'
                    },
                    match: 'rest'
                }
            ]
        });
    }
    
    public async exec(msg: Message, { text }): Promise<Message | void> {
        if (validIDs.includes(msg.author.id) || owners.includes(msg.author.id)) {
            msg.delete();
            msg.channel.startTyping();
            await this.client.wait(1500);
            msg.channel.send(text);
            return msg.channel.stopTyping();
        }
        
        return msg.delete();
    }
}