summaryrefslogtreecommitdiff
path: root/server/src/commands/fun/GitHubZen.ts
blob: a1ffeee7b07b1b6e198c3ec4fc7b8b484d9075cd (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 GitHubZenFun extends Command {
    public constructor() {
        super('githubzen', {
            aliases: ['githubzen', 'github-zen'],
            category: 'fun',
            description: {
                content: 'Gives you a random GitHub design philosophy.',
                usage: '',
                examples: [
                    ''
                ]
            },
            ratelimit: 3
        });
    }
    
    public async exec(msg: Message): Promise<Message> {
        const text = await Axios.get('https://api.github.com/zen').catch(err => {
            console.error(err);
            return msg.reply('Woops, there was an error with the (http://api.github.com) API.');
        });
        //@ts-ignore
        return msg.reply(text.data);
    }
}