summaryrefslogtreecommitdiff
path: root/server/src/commands/fun/Spoiler.ts
blob: fb061f9b9cd421bf4e972e1440aca1607e88fbc0 (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';

export default class SpoilerFun extends Command {
    public constructor() {
        super('spoiler', {
            aliases: ['spoiler'],
            category: 'fun',
            description: {
                content: 'Turn every character in a specified phrase as a ||s||||p||||o||||i||||l||||e||||r||.',
                usage: '[text]',
                examples: [
                    'hide this lol'
                ]
            },
            ratelimit: 3,
            args: [
                {
                    id: 'text',
                    type: 'string',
                    prompt: {
                        start: 'What would you like to *spoil* (hide)?'
                    },
                    match: 'rest'
                },
                {
                    id: 'deleteinitialmessage',
                    flag: ['-delete', '-d'],
                    match: 'flag'
                }
            ]
        });
    }
    
    public exec(msg: Message, { text, deleteinitialmessage }): Promise<Message> {
        if (deleteinitialmessage) msg.delete();
        return msg.channel.send(text.replace(/./g, '||$&||'));
    }
}