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 { 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); } }