import { Command } from 'discord-akairo'; import { Message } from 'discord.js'; import Axios from 'axios'; export default class AdviceFun extends Command { public constructor() { super('advice', { aliases: ['advice'], category: 'fun', description: { content: 'Gives you a random piece of advice.', usage: '', examples: [ '' ] }, ratelimit: 3 }); } public async exec(msg: Message): Promise { const response = await Axios.get('http://api.adviceslip.com/advice').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.slip.advice); } }