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
+9 -1
View File
@@ -120,7 +120,7 @@ don't grant that permission.
## Commands
Total: 377
Total: 380
### Utility:
@@ -260,7 +260,9 @@ Total: 377
* **horoscope:** Responds with today's horoscope for a specific Zodiac sign.
* **humble-bundle:** Responds with the current Humble Bundle.
* **is-tuesday:** Determines if today is Tuesday.
* **iss:** Responds with where the Internation Space Station currently is.
* **neko-atsume-password:** Responds with today's Neko Atsume password.
* **people-in-space:** Responds with the people currently in space.
* **time:** Responds with the current time in a particular location.
* **today-in-history:** Responds with an event that occurred today in history.
@@ -384,6 +386,7 @@ Total: 377
### Image Manipulation:
* **achievement:** Sends a Minecraft achievement with the text of your choice.
* **adorable:** Creates an adorable avatar based on the text you provide.
* **apple-engraving:** Engraves the text of your choice onto an Apple product.
* **approved:** Draws an "approved" stamp over an image or a user's avatar.
* **axis-cult-sign-up:** Sends an Axis Cult Sign-Up sheet for you. Join today!
@@ -582,6 +585,8 @@ here.
* sora-selfie ([Image](https://twitter.com/Candasaurus/status/1041946636656599045))
- [@liltusk](https://twitter.com/liltusk)
* food-broke ([Image](https://twitter.com/liltusk/status/835719948597137408))
- [Adorable Avatars](http://avatars.adorable.io/)
* adorable (API)
- [Advice Slip](https://adviceslip.com/)
* advice ([API](https://api.adviceslip.com/))
- [Alpha Vantage](https://www.alphavantage.co/)
@@ -894,6 +899,9 @@ here.
* npm (API)
- [Numbers API](http://numbersapi.com/)
* number-fact (Trivia API)
- [Open Notify](http://open-notify.org/)
* iss ([ISS Current Location API](http://open-notify.org/Open-Notify-API/ISS-Location-Now/))
* people-in-space ([People in Space API](http://open-notify.org/Open-Notify-API/People-In-Space/))
- [Open Trivia DB](https://opentdb.com/)
* quiz ([API](https://opentdb.com/api_config.php))
* quiz-duel ([API](https://opentdb.com/api_config.php))
+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!`);
}
}
};
+45
View File
@@ -0,0 +1,45 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const { MessageEmbed } = require('discord.js');
const { removeDuplicates } = require('../../util/Util');
module.exports = class PeopleInSpaceCommand extends Command {
constructor(client) {
super(client, {
name: 'people-in-space',
aliases: ['space', 'spacemen', 'astronauts', 'spacewomen'],
group: 'events',
memberName: 'people-in-space',
description: 'Responds with the people currently in space.',
clientPermissions: ['EMBED_LINKS'],
credit: [
{
name: 'Open Notify',
url: 'http://open-notify.org/',
reason: 'People in Space API',
reasonURL: 'http://open-notify.org/Open-Notify-API/People-In-Space/'
}
]
});
}
async run(msg) {
try {
const { body } = await request.get('http://api.open-notify.org/astros.json');
const crafts = {};
for (const person of body.people) {
if (crafts[person.craft]) crafts[person.craft].push(person.name);
else crafts[person.craft] = [person.name];
}
const embed = new MessageEmbed()
.setColor(0x2E528E)
.setImage('https://i.imgur.com/m3ooNfl.jpg');
for (const [craft, people] of Object.entries(crafts)) {
embed.addField(` ${craft} (${people.length})`, people.join('\n'), true);
}
return msg.say(`There are currently **${body.number}** people in space!`, embed);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+39
View File
@@ -0,0 +1,39 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
module.exports = class AdorableCommand extends Command {
constructor(client) {
super(client, {
name: 'adorable',
aliases: ['adorable-avatar'],
group: 'image-edit',
memberName: 'adorable',
description: 'Creates an adorable avatar based on the text you provide.',
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Adorable Avatars',
url: 'http://avatars.adorable.io/',
reason: 'API'
}
],
args: [
{
key: 'text',
prompt: 'What text should be used for generation?',
type: 'string',
parse: text => encodeURIComponent(text)
}
]
});
}
async run(msg, { text }) {
try {
const { body } = await request.get(`https://api.adorable.io/avatars/285/${text}.png`);
return msg.say({ files: [{ attachment: body, name: 'adorable.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "112.16.0",
"version": "112.17.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {