import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; //@ts-ignore no types import emoji from 'emoji-random'; import request from 'node-superfetch' module.exports = class ISSUtility extends Command { constructor(client: CommandoClient) { super(client, { name: 'iss', aliases: ['internationalspacestation', 'international-space-station'], group: 'utility', memberName: 'iss', description: 'Tells you the current location of the International Space Station.', examples: ['uwu!iss'], userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], throttling: { usages: 5, duration: 30 }, }); } async run(msg: CommandoMessage) { try { const { body } = await request.get('http://api.open-notify.org/iss-now.json') //@ts-ignore this exists const pos = body.iss_position return msg.reply(`The ISS is currentaly at **${pos.latitude}, ${pos.longitude}**. ${emoji.random()}`) } catch (err) { return msg.reply(`Woops, an error has occurred: \`${err.message}\`. Try again later! ${emoji.random()}`) } } };