import { Command } from 'discord-akairo'; import { Message } from 'discord.js'; import Axios from 'axios'; export default class NumberFactFun extends Command { public constructor() { super('numberfact', { aliases: ['numberfact', 'number-fact', 'numfact', 'num-fact'], category: 'fun', description: { content: 'Grabs a facts about a specified number.', usage: '[number]', examples: [ '8' ] }, ratelimit: 3, args: [ { id: 'number', type: 'integer', prompt: { start: 'What number would you like to get facts for? (Numeric value)', retry: 'That is not a valid number, please try again.', retries: 3 }, default: 'random', } ] }); } public async exec(msg: Message, { number }): Promise { const fact = await Axios.get(`http://numbersapi.com/${number}`).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); } }