mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-23 18:05:01 +02:00
Discord.js v14
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { PermissionFlagsBits } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const moment = require('moment-timezone');
|
||||
@@ -28,7 +29,7 @@ module.exports = class AnimeAiringCommand extends Command {
|
||||
group: 'events',
|
||||
memberName: 'anime-airing',
|
||||
description: 'Responds with a list of the anime that air today.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'AniList',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const request = require('node-superfetch');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { shorten } = require('../../util/Util');
|
||||
const logos = require('../../assets/json/logos');
|
||||
const { GOV_KEY } = process.env;
|
||||
@@ -13,7 +13,7 @@ module.exports = class ApodCommand extends Command {
|
||||
group: 'events',
|
||||
memberName: 'apod',
|
||||
description: 'Responds with today\'s Astronomy Picture of the Day.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'NASA',
|
||||
@@ -29,14 +29,18 @@ 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 MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(body.title)
|
||||
.setDescription(shorten(body.explanation))
|
||||
.setColor(0x2E528E)
|
||||
.setAuthor('Astronomy Picture of the Day', logos.nasa, 'https://apod.nasa.gov/apod/astropix.html')
|
||||
.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(`Image Credits: ${body.copyright ? body.copyright.replaceAll('\n', '/') : 'Public Domain'}`)
|
||||
.setFooter({ text: `Image Credits: ${body.copyright ? body.copyright.replaceAll('\n', '/') : 'Public Domain'}` })
|
||||
.setTimestamp();
|
||||
return msg.embed(embed);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { PermissionFlagsBits } = require('discord.js');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const request = require('node-superfetch');
|
||||
const cheerio = require('cheerio');
|
||||
@@ -14,7 +15,7 @@ module.exports = class FloridaManCommand extends Command {
|
||||
group: 'events',
|
||||
memberName: 'florida-man',
|
||||
description: 'Responds with the Flordia man of the day.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'floridamanbirthday.org',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { PermissionFlagsBits } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
const moment = require('moment');
|
||||
|
||||
@@ -9,7 +10,7 @@ module.exports = class GoogleDoodleCommand extends Command {
|
||||
group: 'events',
|
||||
memberName: 'google-doodle',
|
||||
description: 'Responds with a Google Doodle, either the latest one or a random one from the past.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
clientPermissions: [PermissionFlagsBits.AttachFiles],
|
||||
credit: [
|
||||
{
|
||||
name: 'Google',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
const cheerio = require('cheerio');
|
||||
const { firstUpperCase } = require('../../util/Util');
|
||||
@@ -13,7 +13,7 @@ module.exports = class HoroscopeCommand extends Command {
|
||||
memberName: 'horoscope',
|
||||
description: 'Responds with today\'s horoscope for a specific Zodiac sign.',
|
||||
details: `**Signs:** ${signs.join(', ')}`,
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'astrology.TV',
|
||||
@@ -35,11 +35,11 @@ module.exports = class HoroscopeCommand extends Command {
|
||||
|
||||
async run(msg, { sign }) {
|
||||
const horoscope = await this.fetchHoroscope(sign);
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0x9797FF)
|
||||
.setTitle(`Horoscope for ${firstUpperCase(sign)}...`)
|
||||
.setURL(`https://astrology.tv/horoscope/signs/${sign}/`)
|
||||
.setFooter('© Kelli Fox, The Astrologer')
|
||||
.setFooter({ text: '© Kelli Fox, The Astrologer' })
|
||||
.setThumbnail(this.getImageURL(sign))
|
||||
.setTimestamp()
|
||||
.setDescription(horoscope);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
const { embedURL } = require('../../util/Util');
|
||||
|
||||
@@ -11,7 +11,7 @@ module.exports = class TodayInHistoryCommand extends Command {
|
||||
group: 'events',
|
||||
memberName: 'today-in-history',
|
||||
description: 'Responds with an event that occurred today in history.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'muffinlabs - Today in History',
|
||||
@@ -44,7 +44,7 @@ module.exports = class TodayInHistoryCommand extends Command {
|
||||
const body = JSON.parse(text);
|
||||
const events = body.data.Events;
|
||||
const event = events[Math.floor(Math.random() * events.length)];
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0x9797FF)
|
||||
.setURL(body.url)
|
||||
.setTitle(`On this day (${body.date})...`)
|
||||
|
||||
Reference in New Issue
Block a user