ISS, People in Space, and Adorable Commands

This commit is contained in:
Dragon Fire
2020-03-26 21:29:55 -04:00
parent c84f1d8c59
commit fc18e7b979
5 changed files with 126 additions and 2 deletions
+32
View File
@@ -0,0 +1,32 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
module.exports = class IssCommand extends Command {
constructor(client) {
super(client, {
name: 'iss',
aliases: ['international-space-station'],
group: 'events',
memberName: 'iss',
description: 'Responds with where the Internation Space Station currently is.',
credit: [
{
name: 'Open Notify',
url: 'http://open-notify.org/',
reason: 'ISS Current Location API',
reasonURL: 'http://open-notify.org/Open-Notify-API/ISS-Location-Now/'
}
]
});
}
async run(msg) {
try {
const { body } = await request.get('http://api.open-notify.org/iss-now.json');
const position = body.iss_position;
return msg.say(`The ISS is currently at **${position.latitude}, ${position.longitude}**.`);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};