mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix APOD/new APOD format
This commit is contained in:
@@ -119,5 +119,7 @@
|
||||
"The respect of influential people will soon be yours.",
|
||||
"The project you have in mind will soon gain momentum.",
|
||||
"You will enjoy doing something fun this coming weekend.",
|
||||
"You will make change for the better."
|
||||
"You will make change for the better.",
|
||||
"Time is precious, but truth is more precious than time.",
|
||||
"You will always get what you want through your charm and personality."
|
||||
]
|
||||
|
||||
+8
-18
@@ -1,8 +1,6 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const request = require('node-superfetch');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
const { shorten } = require('../../util/Util');
|
||||
const logos = require('../../assets/json/logos');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { GOV_KEY } = process.env;
|
||||
|
||||
module.exports = class ApodCommand extends Command {
|
||||
@@ -12,7 +10,6 @@ module.exports = class ApodCommand extends Command {
|
||||
aliases: ['astronomy-picture-of-the-day'],
|
||||
group: 'events',
|
||||
description: 'Responds with today\'s Astronomy Picture of the Day.',
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'NASA',
|
||||
@@ -28,19 +25,12 @@ module.exports = class ApodCommand extends Command {
|
||||
const { body } = await request
|
||||
.get('https://api.nasa.gov/planetary/apod')
|
||||
.query({ api_key: GOV_KEY });
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(body.title)
|
||||
.setDescription(shorten(body.explanation))
|
||||
.setColor(0x2E528E)
|
||||
.setAuthor({
|
||||
name: 'Astronomy Picture of the Day',
|
||||
iconURL: logos.nasa,
|
||||
url: 'https://apod.nasa.gov/apod/astropix.html'
|
||||
})
|
||||
.setImage(body.media_type === 'image' ? body.url : null)
|
||||
.setURL(body.url)
|
||||
.setFooter({ text: `Image Credits: ${body.copyright ? body.copyright.replaceAll('\n', '/') : 'Public Domain'}` })
|
||||
.setTimestamp();
|
||||
return msg.embed(embed);
|
||||
const credit = body.copyright ? body.copyright.replaceAll('\n', '/') : 'Public Domain';
|
||||
return msg.say(stripIndents`
|
||||
**${body.title}**
|
||||
${body.explanation}
|
||||
|
||||
_Image Credits: (${credit})[https://apod.nasa.gov/apod/astropix.html]_
|
||||
`, { files: body.media_type === 'image' ? [body.url] : [] });
|
||||
}
|
||||
};
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "152.5.2",
|
||||
"version": "152.5.3",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user