summaryrefslogtreecommitdiff
path: root/server/src/commands/minigames/8Ball.ts
blob: 10bf06d661e32761d23c0d3e570fe6544abba6d0 (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
43
import { Command } from 'discord-akairo';
import { Message } from 'discord.js';
import * as EightBallResponses from '../../json/8ball.json'
import { colour } from '../../Config';

export default class EightBallMinigames extends Command {
    public constructor() {
        super('8ball', {
            aliases: ['8ball', '8b', '8-ball', '8-b'],
            category: 'minigames',
            description: {
                content: 'Shake the magic 8 Ball for a fortune!',
                usage: '[question]',
                examples: [
                    'will I ever get married?'
                ]
            },
            ratelimit: 3,
            args: [
                {
                    id: 'darlinginthefranxx',
                    flag: ['-ditf'],
                    match: 'flag'
                }
            ]
        });
    }
    
    public exec(msg: Message, { darlinginthefranxx }): Promise<Message> {
        let randomResponse;
        if (darlinginthefranxx)
            randomResponse = EightBallResponses.standard[Math.floor(Math.random() * EightBallResponses.standard.length)];
        else 
            randomResponse = EightBallResponses.ditf[Math.floor(Math.random() * EightBallResponses.ditf.length)];

        const embed = this.client.util.embed()
            .setColor(colour)
            .setAuthor('The 8-ball says',
                'https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/8-Ball_Pool.svg/500px-8-Ball_Pool.svg.png')
            .setDescription(`\`${randomResponse}\``);
        return msg.channel.send(embed);
    }
}