summaryrefslogtreecommitdiff
path: root/server/src/commands/fun/Insult.ts
blob: 941824f696a16069003af09e2f422dfb140e98b4 (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 InsultFun extends Command {
    public constructor() {
        super('insult', {
            aliases: ['insult', 'roast', 'roastwilly'],
            category: 'fun',
            description: {
                content: 'Gives you a random insult.',
                usage: '',
                examples: [
                    ''
                ]
            },
            ratelimit: 3
        });
    }
    
    public async exec(msg: Message): Promise<Message> {
        const response = await Axios.get('https://evilinsult.com/generate_insult.php?lang=en&type=json').catch(err => {
            console.error(err);
            return msg.reply('Woops, there was an error regarding the (http://numbersapi.com) API.');
        });
        //@ts-ignore
        return msg.reply(response.data.insult);
    }
}