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

export default class OwlAnimals extends Command {
    public constructor() {
        super('owl', {
            aliases: ['owl'],
            category: 'animals',
            description: {
                content: 'Gives you a random owl!',
                usage: '',
                examples: [
                    ''
                ]
            },
            ratelimit: 3,
            clientPermissions: ['EMBED_LINKS']
        });
    }
    
    public async exec(msg: Message): Promise<Message> {
        const animal = await Axios.get(`http://pics.floofybot.moe/owl`).catch(err => {
            console.error(err);
            msg.reply('Woops, there was an error with the (http://pics.floofybot.moe/owl) API.');
        });
        
        const embed = this.client.util.embed()
            .setColor(colour)
            .setAuthor('pics.floofybot.moe/owl', 'http://pics.floofybot.moe/assets/favicon.svg', 'http://pics.floofybot.moe/')
            //@ts-ignore
            .setImage(animal.data.image);
        return msg.channel.send(embed);
    }
}