Discord.js v14

This commit is contained in:
Dragon Fire
2024-04-07 19:06:19 -04:00
parent 58c81aa912
commit f59826f7ab
272 changed files with 893 additions and 656 deletions
+2 -1
View File
@@ -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',
+9 -5
View File
@@ -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);
}
+2 -1
View File
@@ -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',
+2 -1
View File
@@ -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',
+4 -4
View File
@@ -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);
+3 -3
View File
@@ -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})...`)