summaryrefslogtreecommitdiff
path: root/server/src/commands/fun/YoMomma.ts
blob: f156e8d919b56910bc4a3c23dfb2c365ecc2848f (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
import { Command } from 'discord-akairo';
import { Message } from 'discord.js';
import Axios from 'axios';

export default class YoMommaFun extends Command {
    public constructor() {
        super('yomomma', {
            aliases: ['yomomma', 'yo-momma'],
            category: 'fun',
            description: {
                content: 'Grabs a "Yo Momma" joke.',
                usage: '',
                examples: [
                    ''
                ]
            },
            ratelimit: 3
        });
    }
    
    public async exec(msg: Message): Promise<Message> {
        const fact = await Axios.get('https://api.yomomma.info/').catch(err => {
            console.error(err);
            return msg.reply('Woops, there was an error with the (https://api.yomomma.info/) API.');
        });
        //@ts-ignore
        return msg.reply(fact.data.joke);
    }
}