diff options
Diffstat (limited to 'server/src/commands/animals/Bunny.ts')
| -rw-r--r-- | server/src/commands/animals/Bunny.ts | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/server/src/commands/animals/Bunny.ts b/server/src/commands/animals/Bunny.ts new file mode 100644 index 0000000..5325002 --- /dev/null +++ b/server/src/commands/animals/Bunny.ts @@ -0,0 +1,36 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; +import { colour } from '../../Config'; + +export default class BunnyAnimals extends Command { + public constructor() { + super('bunny', { + aliases: ['bunny'], + category: 'animals', + description: { + content: 'Gives you a random bunny!', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3, + clientPermissions: ['EMBED_LINKS'] + }); + } + + public async exec(msg: Message): Promise<Message> { + const animal = await Axios.get(`https://api.bunnies.io/v2/loop/random/?media=gif,png`).catch(err => { + console.error(err); + msg.reply('Woops, there was an error with the (http://api.bunies.io/) API.'); + }); + + const embed = this.client.util.embed() + .setColor(colour) + .setAuthor('bunnies.io') + //@ts-ignore + .setImage(animal.data.media.gif); + return msg.channel.send(embed); + } +}
\ No newline at end of file |