1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
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()}`)
}
}
};
|