import { Command } from 'discord-akairo'; import { Message } from 'discord.js'; import Axios from 'axios'; export default class DayFactFun extends Command { public constructor() { super('dayfact', { aliases: ['dayfact'], category: 'fun', description: { content: 'Grabs a fact about a specified day.', usage: '[numeric day]', examples: [ '8' ] }, ratelimit: 3, args: [ { id: 'day', type: 'integer', prompt: { start: 'What day would you like to get facts for? (Numeric value)', retry: 'That is not a valid day, please try again.', retries: 3 }, default: 'random', } ] }); } public async exec(msg: Message, { day }): Promise { const fact = await Axios.get(`http://numbersapi.com/${day}/date`).catch(err => { console.error(err); return msg.reply('Woops, there was an error with the (http://numbersapi.com) API.'); }); //@ts-ignore return msg.reply(fact.data); } }