mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 14:04:38 +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 searchGraphQL = stripIndents`
|
||||
@@ -20,7 +21,7 @@ module.exports = class AnilistCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'anilist',
|
||||
description: 'Responds with user information for an Anilist user.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'AniList',
|
||||
|
||||
@@ -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 { stripIndents } = require('common-tags');
|
||||
const { embedURL, cleanAnilistHTML, trimArray } = require('../../util/Util');
|
||||
@@ -53,7 +53,7 @@ module.exports = class AnimeCharacterCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'anime-character',
|
||||
description: 'Searches AniList for your query, getting character results.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'AniList',
|
||||
@@ -75,9 +75,9 @@ module.exports = class AnimeCharacterCommand extends Command {
|
||||
const id = await this.search(query);
|
||||
if (!id) return msg.say('Could not find any results.');
|
||||
const character = await this.fetchCharacter(id);
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0x02A9FF)
|
||||
.setAuthor('AniList', logos.anilist, 'https://anilist.co/')
|
||||
.setAuthor({ name: 'AniList', iconURL: logos.anilist, url: 'https://anilist.co/' })
|
||||
.setURL(character.siteUrl)
|
||||
.setThumbnail(character.image.large || character.image.medium || null)
|
||||
.setTitle(`${character.name.first || ''}${character.name.last ? ` ${character.name.last}` : ''}`)
|
||||
|
||||
@@ -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 { stripIndents } = require('common-tags');
|
||||
const { embedURL, cleanAnilistHTML, trimArray } = require('../../util/Util');
|
||||
@@ -73,7 +73,7 @@ module.exports = class AnimeStaffCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'anime-staff',
|
||||
description: 'Searches AniList for your query, getting staff results.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'AniList',
|
||||
@@ -95,9 +95,9 @@ module.exports = class AnimeStaffCommand extends Command {
|
||||
const id = await this.search(query);
|
||||
if (!id) return msg.say('Could not find any results.');
|
||||
const staff = await this.fetchStaff(id);
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0x02A9FF)
|
||||
.setAuthor('AniList', logos.anilist, 'https://anilist.co/')
|
||||
.setAuthor({ name: 'AniList', iconURL: logos.anilist, url: 'https://anilist.co/' })
|
||||
.setURL(staff.siteUrl)
|
||||
.setThumbnail(staff.image.large || staff.image.medium || null)
|
||||
.setTitle(`${staff.name.first || ''}${staff.name.last ? ` ${staff.name.last}` : ''}`)
|
||||
|
||||
@@ -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 { stripIndents } = require('common-tags');
|
||||
@@ -85,7 +85,7 @@ module.exports = class AnimeCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'anime',
|
||||
description: 'Searches AniList for your query, getting anime results.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'AniList',
|
||||
@@ -118,9 +118,9 @@ module.exports = class AnimeCommand extends Command {
|
||||
const entry = this.personalList.find(ani => ani.mediaId === id);
|
||||
const malScore = await this.fetchMALScore(anime.idMal);
|
||||
const malURL = `https://myanimelist.net/anime/${anime.idMal}`;
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0x02A9FF)
|
||||
.setAuthor('AniList', logos.anilist, 'https://anilist.co/')
|
||||
.setAuthor({ name: 'AniList', iconURL: logos.anilist, url: 'https://anilist.co/' })
|
||||
.setURL(anime.siteUrl)
|
||||
.setThumbnail(anime.coverImage.large || anime.coverImage.medium || null)
|
||||
.setTitle(anime.title.english || anime.title.romaji)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const moment = require('moment');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
const { shorten, formatNumber } = require('../../util/Util');
|
||||
const logos = require('../../assets/json/logos');
|
||||
@@ -14,7 +14,7 @@ module.exports = class GithubCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'github',
|
||||
description: 'Responds with information on a GitHub repository.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'GitHub',
|
||||
@@ -43,9 +43,9 @@ module.exports = class GithubCommand extends Command {
|
||||
const { body } = await request
|
||||
.get(`https://api.github.com/repos/${author}/${repository}`)
|
||||
.set({ Authorization: `token ${GITHUB_ACCESS_TOKEN}` });
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xFFFFFF)
|
||||
.setAuthor('GitHub', logos.github, 'https://github.com/')
|
||||
.setAuthor({ name: 'GitHub', iconURL: logos.github, url: 'https://github.com/' })
|
||||
.setTitle(body.full_name)
|
||||
.setURL(body.html_url)
|
||||
.setDescription(body.description ? shorten(body.description) : 'No description.')
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { PermissionFlagsBits } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
const { hash } = require('../../util/Util');
|
||||
|
||||
@@ -9,7 +10,7 @@ module.exports = class GravatarCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'gravatar',
|
||||
description: 'Responds with the Gravatar for an email.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
clientPermissions: [PermissionFlagsBits.AttachFiles],
|
||||
credit: [
|
||||
{
|
||||
name: 'Gravatar',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { PermissionFlagsBits } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
|
||||
module.exports = class HttpCatCommand extends Command {
|
||||
@@ -8,7 +9,7 @@ module.exports = class HttpCatCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'http-cat',
|
||||
description: 'Responds with a cat for an HTTP status code.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
clientPermissions: [PermissionFlagsBits.AttachFiles],
|
||||
credit: [
|
||||
{
|
||||
name: 'HTTP Cats',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const request = require('node-superfetch');
|
||||
const cheerio = require('cheerio');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
const { shorten } = require('../../util/Util');
|
||||
const logos = require('../../assets/json/logos');
|
||||
|
||||
@@ -13,7 +13,7 @@ module.exports = class KnowYourMemeCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'know-your-meme',
|
||||
description: 'Searches Know Your Meme for your query.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'Know Your Meme',
|
||||
@@ -34,9 +34,9 @@ module.exports = class KnowYourMemeCommand extends Command {
|
||||
const location = await this.search(query);
|
||||
if (!location) return msg.say('Could not find any results.');
|
||||
const data = await this.fetchMeme(location);
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0x12133F)
|
||||
.setAuthor('Know Your Meme', logos.kym, 'https://knowyourmeme.com/')
|
||||
.setAuthor({ name: 'Know Your Meme', iconURL: logos.kym, url: 'https://knowyourmeme.com/' })
|
||||
.setTitle(data.name)
|
||||
.setDescription(shorten(data.description || 'No description available.'))
|
||||
.setURL(data.url)
|
||||
|
||||
@@ -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 logos = require('../../assets/json/logos');
|
||||
|
||||
module.exports = class LorcanaCommand extends Command {
|
||||
@@ -40,17 +40,17 @@ module.exports = class LorcanaCommand extends Command {
|
||||
if (!card) return msg.say('Could not find any results.');
|
||||
const oracleText = card.Body_Text ? card.Body_Text.replace(/{i}/g, 'Ink') : `_${card.Flavor_Text}_`;
|
||||
const classifications = card.Classifications ? `- ${card.Classifications}` : '';
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setURL(card.Image)
|
||||
.setColor(0xD3B078)
|
||||
.setThumbnail(card.Image)
|
||||
.setDescription(`{${card.Cost}} ${card.Type}${classifications}\n\n${oracleText}`)
|
||||
.setAuthor('Lorcana', logos.lorcana, 'https://www.disneylorcana.com/en-US')
|
||||
.setAuthor({ name: 'Lorcana', iconURL: logos.lorcana, url: 'https://www.disneylorcana.com/en-US' })
|
||||
.setTitle(card.Name)
|
||||
.setFooter(`${card.Set_Name} - ${card.Card_Num}`)
|
||||
.setFooter({ text: `${card.Set_Name} - ${card.Card_Num}` })
|
||||
.addField('❯ Color', card.Color, true)
|
||||
.addField('❯ Inkable?', card.Inkable ? 'Yes' : 'No', true)
|
||||
.addField('\u200B', '\u200B', true);
|
||||
.addBlankField(true);
|
||||
if (card.Type === 'Character') {
|
||||
embed.addField('❯ Strength', card.Strength.toString(), true);
|
||||
embed.addField('❯ Willpower', card.Willpower.toString(), true);
|
||||
|
||||
@@ -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 { stripIndents } = require('common-tags');
|
||||
const logos = require('../../assets/json/logos');
|
||||
|
||||
@@ -59,17 +59,17 @@ module.exports = class MagicCommand extends Command {
|
||||
const isMDFC = Boolean(card.card_faces);
|
||||
const oracleText = isMDFC ? card.card_faces.map(c => c.oracle_text).join('\n\n//\n\n') : card.oracle_text;
|
||||
const manaCost = isMDFC ? card.card_faces.map(c => c.mana_cost).join(' // ') : card.mana_cost;
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setURL(card.scryfall_uri)
|
||||
.setColor(0x2B253A)
|
||||
.setThumbnail(card.card_faces ? card.card_faces[0].image_uris.art_crop : card.image_uris.art_crop)
|
||||
.setDescription(`${manaCost} ${card.type_line}\n\n${oracleText}`)
|
||||
.setAuthor('Scryfall', logos.scryfall, 'https://scryfall.com/')
|
||||
.setAuthor({ name: 'Scryfall', iconURL: logos.scryfall, url: 'https://scryfall.com/' })
|
||||
.setTitle(card.name);
|
||||
if (card.power && card.toughness) {
|
||||
embed.addField('❯ Power', card.power, true);
|
||||
embed.addField('❯ Toughness', card.toughness, true);
|
||||
embed.addField('\u200B', '\u200B', true);
|
||||
embed.addBlankField(true);
|
||||
}
|
||||
if (card.loyalty) {
|
||||
embed.addField('❯ Loyalty', card.loyalty);
|
||||
|
||||
@@ -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 { stripIndents } = require('common-tags');
|
||||
@@ -78,7 +78,7 @@ module.exports = class MangaCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'manga',
|
||||
description: 'Searches AniList for your query, getting manga results.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'AniList',
|
||||
@@ -111,9 +111,9 @@ module.exports = class MangaCommand extends Command {
|
||||
const entry = this.personalList.find(ma => ma.mediaId === id);
|
||||
const malScore = await this.fetchMALScore(manga.idMal);
|
||||
const malURL = `https://myanimelist.net/manga/${manga.idMal}`;
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0x02A9FF)
|
||||
.setAuthor('AniList', logos.anilist, 'https://anilist.co/')
|
||||
.setAuthor({ name: 'AniList', iconURL: logos.anilist, url: 'https://anilist.co/' })
|
||||
.setURL(manga.siteUrl)
|
||||
.setThumbnail(manga.coverImage.large || manga.coverImage.medium || null)
|
||||
.setTitle(manga.title.english || manga.title.romaji)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const request = require('node-superfetch');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
const { shorten, embedURL } = require('../../util/Util');
|
||||
const logos = require('../../assets/json/logos');
|
||||
|
||||
@@ -11,7 +11,7 @@ module.exports = class NASACommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'nasa',
|
||||
description: 'Searches NASA\'s image archive for your query.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'NASA',
|
||||
@@ -39,13 +39,13 @@ module.exports = class NASACommand extends Command {
|
||||
const images = body.collection.items;
|
||||
if (!images.length) return msg.say('Could not find any results.');
|
||||
const data = images[Math.floor(Math.random() * images.length)];
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(shorten(data.data[0].title, 256))
|
||||
.setDescription(shorten(this.cleanHTML(data.data[0].description)))
|
||||
.setColor(0x2E528E)
|
||||
.setAuthor('NASA', logos.nasa, 'https://www.nasa.gov/multimedia/imagegallery/index.html')
|
||||
.setAuthor({ name: 'NASA', iconURL: logos.nasa, url: 'https://www.nasa.gov/multimedia/imagegallery/index.html' })
|
||||
.setImage(`https://images-assets.nasa.gov/image/${data.data[0].nasa_id}/${data.data[0].nasa_id}~thumb.jpg`)
|
||||
.setFooter(`Image Credits: ${data.data[0].center || 'Public Domain'}`)
|
||||
.setFooter({ text: `Image Credits: ${data.data[0].center || 'Public Domain'}` })
|
||||
.setTimestamp(new Date(data.data[0].date_created));
|
||||
return msg.embed(embed);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const request = require('node-superfetch');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
const { formatNumber } = require('../../util/Util');
|
||||
const logos = require('../../assets/json/logos');
|
||||
|
||||
@@ -12,7 +12,7 @@ module.exports = class NeopetsItemCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'neopets-item',
|
||||
description: 'Responds with information on a specific Neopets item.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'Neopets',
|
||||
@@ -37,9 +37,9 @@ module.exports = class NeopetsItemCommand extends Command {
|
||||
async run(msg, { item }) {
|
||||
const data = await this.fetchItem(item);
|
||||
if (!data) return msg.say('Could not find any results.');
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xFFCE31)
|
||||
.setAuthor('Neopets', logos.neopets, 'http://www.neopets.com/')
|
||||
.setAuthor({ name: 'Neopets', iconURL: logos.neopets, url: 'http://www.neopets.com/' })
|
||||
.setTitle(data.name)
|
||||
.setDescription(data.details)
|
||||
.setURL(data.url)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const moment = require('moment');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
const { trimArray } = require('../../util/Util');
|
||||
const logos = require('../../assets/json/logos');
|
||||
@@ -12,7 +12,7 @@ module.exports = class NPMCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'npm',
|
||||
description: 'Responds with information on an NPM package.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'npm',
|
||||
@@ -38,9 +38,9 @@ module.exports = class NPMCommand extends Command {
|
||||
const version = body.versions[body['dist-tags'].latest];
|
||||
const maintainers = trimArray(body.maintainers.map(user => user.name));
|
||||
const dependencies = version.dependencies ? trimArray(Object.keys(version.dependencies)) : null;
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xCB0000)
|
||||
.setAuthor('NPM', logos.npm, 'https://www.npmjs.com/')
|
||||
.setAuthor({ name: 'NPM', iconURL: logos.npm, url: 'https://www.npmjs.com/' })
|
||||
.setTitle(body.name)
|
||||
.setURL(`https://www.npmjs.com/package/${pkg}`)
|
||||
.setDescription(body.description || 'No description.')
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { PermissionFlagsBits } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const path = require('path');
|
||||
@@ -28,7 +29,7 @@ module.exports = class PeriodicTableCommand extends Command {
|
||||
usages: 2,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
clientPermissions: [PermissionFlagsBits.AttachFiles],
|
||||
credit: [
|
||||
{
|
||||
name: 'Bowserinator',
|
||||
|
||||
@@ -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 { shorten, formatNumber } = require('../../util/Util');
|
||||
const logos = require('../../assets/json/logos');
|
||||
@@ -12,7 +12,7 @@ module.exports = class UrbanCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'urban',
|
||||
description: 'Defines a word, but with Urban Dictionary.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'Urban Dictionary',
|
||||
@@ -36,13 +36,13 @@ module.exports = class UrbanCommand extends Command {
|
||||
.query({ term: word });
|
||||
if (!body.list.length) return msg.say('Could not find any results.');
|
||||
const data = body.list[0];
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0x32A8F0)
|
||||
.setAuthor('Urban Dictionary', logos.urban, 'https://www.urbandictionary.com/')
|
||||
.setAuthor({ name: 'Urban Dictionary', iconURL: logos.urban, url: 'https://www.urbandictionary.com/' })
|
||||
.setURL(data.permalink)
|
||||
.setTitle(data.word)
|
||||
.setDescription(shorten(data.definition.replace(/\[|\]/g, '')))
|
||||
.setFooter(`👍 ${formatNumber(data.thumbs_up)} 👎 ${formatNumber(data.thumbs_down)}`)
|
||||
.setFooter({ text: `👍 ${formatNumber(data.thumbs_up)} 👎 ${formatNumber(data.thumbs_down)}` })
|
||||
.setTimestamp(new Date(data.written_on))
|
||||
.addField('❯ Example', data.example ? shorten(data.example.replace(/\[|\]/g, ''), 1000) : 'None');
|
||||
return msg.embed(embed);
|
||||
|
||||
@@ -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 { shorten } = require('../../util/Util');
|
||||
const logos = require('../../assets/json/logos');
|
||||
@@ -11,7 +11,7 @@ module.exports = class WikipediaCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'wikipedia',
|
||||
description: 'Searches Wikipedia for your query.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'Wikipedia',
|
||||
@@ -44,10 +44,10 @@ module.exports = class WikipediaCommand extends Command {
|
||||
});
|
||||
const data = body.query.pages[0];
|
||||
if (data.missing) return msg.say('Could not find any results.');
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xE7E7E7)
|
||||
.setTitle(data.title)
|
||||
.setAuthor('Wikipedia', logos.wikipedia, 'https://www.wikipedia.org/')
|
||||
.setAuthor({ name: 'Wikipedia', iconURL: logos.wikipedia, url: 'https://www.wikipedia.org/' })
|
||||
.setURL(`https://en.wikipedia.org/wiki/${encodeURIComponent(query).replaceAll(')', '%29')}`)
|
||||
.setDescription(shorten(data.extract.replaceAll('\n', '\n\n')));
|
||||
return msg.embed(embed);
|
||||
|
||||
@@ -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 types = ['random', 'today'];
|
||||
|
||||
@@ -11,7 +11,7 @@ module.exports = class XKCDCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'xkcd',
|
||||
description: 'Responds with an XKCD comic, either today\'s, a random one, or a specific one.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'xkcd',
|
||||
@@ -40,34 +40,34 @@ module.exports = class XKCDCommand extends Command {
|
||||
async run(msg, { query }) {
|
||||
const current = await request.get('https://xkcd.com/info.0.json');
|
||||
if (query === 'today') {
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(`${current.body.num} - ${current.body.title}`)
|
||||
.setColor(0x9797FF)
|
||||
.setURL(`https://xkcd.com/${current.body.num}`)
|
||||
.setImage(current.body.img)
|
||||
.setFooter(current.body.alt);
|
||||
.setFooter({ text: current.body.alt });
|
||||
return msg.embed(embed);
|
||||
}
|
||||
if (query === 'random') {
|
||||
const random = Math.floor(Math.random() * current.body.num) + 1;
|
||||
const { body } = await request.get(`https://xkcd.com/${random}/info.0.json`);
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(`${body.num} - ${body.title}`)
|
||||
.setColor(0x9797FF)
|
||||
.setURL(`https://xkcd.com/${body.num}`)
|
||||
.setImage(body.img)
|
||||
.setFooter(body.alt);
|
||||
.setFooter({ text: body.alt });
|
||||
return msg.embed(embed);
|
||||
}
|
||||
const choice = Number.parseInt(query, 10);
|
||||
if (current.body.num < choice) return msg.say('Could not find any results.');
|
||||
const { body } = await request.get(`https://xkcd.com/${choice}/info.0.json`);
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(`${body.num} - ${body.title}`)
|
||||
.setColor(0x9797FF)
|
||||
.setURL(`https://xkcd.com/${body.num}`)
|
||||
.setImage(body.img)
|
||||
.setFooter(body.alt);
|
||||
.setFooter({ text: body.alt });
|
||||
return msg.embed(embed);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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 { shorten, formatNumber } = require('../../util/Util');
|
||||
const logos = require('../../assets/json/logos');
|
||||
@@ -12,7 +12,7 @@ module.exports = class YuGiOhCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'yu-gi-oh',
|
||||
description: 'Responds with info on a Yu-Gi-Oh! card.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'Konami',
|
||||
@@ -45,14 +45,14 @@ module.exports = class YuGiOhCommand extends Command {
|
||||
la: 'english'
|
||||
});
|
||||
const data = body.data[0];
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xBE5F1F)
|
||||
.setTitle(data.name)
|
||||
.setURL(`https://db.ygoprodeck.com/card/?search=${data.id}`)
|
||||
.setDescription(data.type === 'Normal Monster' ? `_${shorten(data.desc)}_` : shorten(data.desc))
|
||||
.setAuthor('Yu-Gi-Oh!', logos.yugioh, 'http://www.yugioh-card.com/')
|
||||
.setAuthor({ name: 'Yu-Gi-Oh!', iconURL: logos.yugioh, url: 'http://www.yugioh-card.com/' })
|
||||
.setThumbnail(data.card_images[0].image_url)
|
||||
.setFooter(data.id.toString())
|
||||
.setFooter({ text: data.id.toString() })
|
||||
.addField('❯ Type', data.type, true)
|
||||
.addField(data.type.includes('Monster') ? '❯ Race' : '❯ Spell Type', data.race, true);
|
||||
if (data.type.includes('Monster')) {
|
||||
|
||||
Reference in New Issue
Block a user