mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 22:32:52 +02:00
Discord.js v14
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
|
||||
module.exports = class PokedexAbilityCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -9,7 +9,7 @@ module.exports = class PokedexAbilityCommand extends Command {
|
||||
group: 'pokedex',
|
||||
memberName: 'pokedex-ability',
|
||||
description: 'Searches the Pokédex for a Pokémon ability.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'Pokémon',
|
||||
@@ -34,7 +34,7 @@ module.exports = class PokedexAbilityCommand extends Command {
|
||||
async run(msg, { ability }) {
|
||||
const data = await this.client.pokemon.abilities.fetch(ability);
|
||||
if (!data) return msg.say('Could not find any results.');
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xED1C24)
|
||||
.setTitle(data.name)
|
||||
.setDescription(data.description || 'No description available.');
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { PermissionFlagsBits } = require('discord.js');
|
||||
const { createCanvas } = require('canvas');
|
||||
const { cropToContent } = require('../../util/Canvas');
|
||||
|
||||
@@ -31,7 +32,7 @@ module.exports = class PokedexBoxSpriteCommand extends Command {
|
||||
group: 'pokedex',
|
||||
memberName: 'pokedex-box-sprite',
|
||||
description: 'Responds with the box sprite of a Pokémon.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
clientPermissions: [PermissionFlagsBits.AttachFiles],
|
||||
credit: [
|
||||
{
|
||||
name: 'Pokémon',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { PermissionFlagsBits } = require('discord.js');
|
||||
const { reactIfAble } = require('../../util/Util');
|
||||
|
||||
module.exports = class PokedexCryCommand extends Command {
|
||||
@@ -9,7 +10,7 @@ module.exports = class PokedexCryCommand extends Command {
|
||||
group: 'pokedex',
|
||||
memberName: 'pokedex-cry',
|
||||
description: 'Plays a Pokémon\'s cry.',
|
||||
userPermissions: ['CONNECT', 'SPEAK'],
|
||||
userPermissions: [PermissionFlagsBits.Connect, PermissionFlagsBits.Speak],
|
||||
throttling: {
|
||||
usages: 2,
|
||||
duration: 10
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { PermissionFlagsBits } = require('discord.js');
|
||||
|
||||
module.exports = class PokedexImageCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -18,7 +19,7 @@ module.exports = class PokedexImageCommand extends Command {
|
||||
group: 'pokedex',
|
||||
memberName: 'pokedex-image',
|
||||
description: 'Responds with the image of a Pokémon.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
clientPermissions: [PermissionFlagsBits.AttachFiles],
|
||||
credit: [
|
||||
{
|
||||
name: 'Pokémon',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
|
||||
module.exports = class PokedexItemCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -9,7 +9,7 @@ module.exports = class PokedexItemCommand extends Command {
|
||||
group: 'pokedex',
|
||||
memberName: 'pokedex-item',
|
||||
description: 'Searches the Pokédex for a Pokémon item.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'Pokémon',
|
||||
@@ -34,7 +34,7 @@ module.exports = class PokedexItemCommand extends Command {
|
||||
async run(msg, { item }) {
|
||||
const data = await this.client.pokemon.items.fetch(item);
|
||||
if (!data) return msg.say('Could not find any results.');
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xED1C24)
|
||||
.setTitle(data.name)
|
||||
.setDescription(data.description || 'No description available.')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
const versions = require('../../assets/json/pokedex-location');
|
||||
|
||||
module.exports = class PokedexLocationCommand extends Command {
|
||||
@@ -20,7 +20,7 @@ module.exports = class PokedexLocationCommand extends Command {
|
||||
group: 'pokedex',
|
||||
memberName: 'pokedex-location',
|
||||
description: 'Responds with the location data for a Pokémon.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'Pokémon',
|
||||
@@ -61,9 +61,13 @@ module.exports = class PokedexLocationCommand extends Command {
|
||||
.map(location => `${location.name} (${location.versions.map(v => versions[v]).join('/')})`)
|
||||
.join('\n')
|
||||
: 'Location Unknown';
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xED1C24)
|
||||
.setAuthor(`#${pokemon.displayID} - ${pokemon.name}`, 'attachment://box.png', pokemon.serebiiURL)
|
||||
.setAuthor({
|
||||
name: `#${pokemon.displayID} - ${pokemon.name}`,
|
||||
iconURL: 'attachment://box.png',
|
||||
url: pokemon.serebiiURL
|
||||
})
|
||||
.setDescription(desc)
|
||||
.setThumbnail(pokemon.spriteImageURL);
|
||||
return msg.channel.send({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
|
||||
module.exports = class PokedexMoveCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -9,7 +9,7 @@ module.exports = class PokedexMoveCommand extends Command {
|
||||
group: 'pokedex',
|
||||
memberName: 'pokedex-move',
|
||||
description: 'Searches the Pokédex for a Pokémon move.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'Pokémon',
|
||||
@@ -34,7 +34,7 @@ module.exports = class PokedexMoveCommand extends Command {
|
||||
async run(msg, { move }) {
|
||||
const data = await this.client.pokemon.moves.fetch(move);
|
||||
if (!data) return msg.say('Could not find any results.');
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xED1C24)
|
||||
.setTitle(data.name)
|
||||
.setDescription(data.description ? data.cleanDescription : 'No description available.')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
const versions = {
|
||||
'red-blue': 'Red and Blue',
|
||||
'ultra-sun-ultra-moon': 'Ultra Sun and Ultra Moon',
|
||||
@@ -25,7 +25,7 @@ module.exports = class PokedexMovesetCommand extends Command {
|
||||
group: 'pokedex',
|
||||
memberName: 'pokedex-moveset',
|
||||
description: 'Responds with the moveset for a Pokémon.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'Pokémon',
|
||||
@@ -61,12 +61,16 @@ module.exports = class PokedexMovesetCommand extends Command {
|
||||
async run(msg, { pokemon }) {
|
||||
if (!pokemon.gameDataCached) await pokemon.fetchGameData();
|
||||
if (!pokemon.moveSet.length) return msg.say('This Pokémon\'s moves are not yet documented.');
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xED1C24)
|
||||
.setAuthor(`#${pokemon.displayID} - ${pokemon.name}`, 'attachment://box.png', pokemon.serebiiURL)
|
||||
.setAuthor({
|
||||
name: `#${pokemon.displayID} - ${pokemon.name}`,
|
||||
iconURL: 'attachment://box.png',
|
||||
url: pokemon.serebiiURL
|
||||
})
|
||||
.setDescription(pokemon.moveSet.map(move => `**Level ${move.level}:** ${move.move.name}`).join('\n'))
|
||||
.setThumbnail(pokemon.spriteImageURL)
|
||||
.setFooter(`Moveset data taken from ${versions[pokemon.moveSetVersion]}.`);
|
||||
.setFooter({ text: `Moveset data taken from ${versions[pokemon.moveSetVersion]}.` });
|
||||
return msg.channel.send({
|
||||
embeds: [embed],
|
||||
files: [{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { list } = require('../../util/Util');
|
||||
|
||||
@@ -11,7 +11,7 @@ module.exports = class PokedexCommand extends Command {
|
||||
group: 'pokedex',
|
||||
memberName: 'pokedex-stats',
|
||||
description: 'Responds with the stats for a Pokémon.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'Pokémon',
|
||||
@@ -75,13 +75,13 @@ module.exports = class PokedexCommand extends Command {
|
||||
spd: Math.round((variety.stats.spd / 255) * 10) * 2,
|
||||
total: Math.round((statTotal / 1125) * 10) * 2
|
||||
};
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xED1C24)
|
||||
.setAuthor(
|
||||
`#${pokemon.displayID} - ${pokemon.name}`,
|
||||
'attachment://box.png',
|
||||
pokemon.serebiiURL
|
||||
)
|
||||
.setAuthor({
|
||||
name: `#${pokemon.displayID} - ${pokemon.name}`,
|
||||
iconURL: 'attachment://box.png',
|
||||
url: pokemon.serebiiURL
|
||||
})
|
||||
.setThumbnail(pokemon.formSpriteImageURL(variety.id))
|
||||
.addField(`❯ Base Stats (${variety.name || 'Normal'} Form)`, stripIndents`
|
||||
\`HP: [${'█'.repeat(repeat.hp)}${' '.repeat(20 - repeat.hp)}]\` **${variety.stats.hp}**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { arrayEquals, reactIfAble, firstUpperCase } = require('../../util/Util');
|
||||
const { MEGA_EVOLVE_EMOJI_NAME, MEGA_EVOLVE_EMOJI_ID } = process.env;
|
||||
@@ -24,7 +24,7 @@ module.exports = class PokedexCommand extends Command {
|
||||
group: 'pokedex',
|
||||
memberName: 'pokedex',
|
||||
description: 'Searches the Pokédex for a Pokémon.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'Pokémon',
|
||||
@@ -95,9 +95,13 @@ module.exports = class PokedexCommand extends Command {
|
||||
if (found.id === pokemon.id) return `**${found.name}**`;
|
||||
return found.name;
|
||||
}).join(' -> ');
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xED1C24)
|
||||
.setAuthor(`#${pokemon.displayID} - ${pokemon.name}`, 'attachment://box.png', pokemon.serebiiURL)
|
||||
.setAuthor({
|
||||
name: `#${pokemon.displayID} - ${pokemon.name}`,
|
||||
iconURL: 'attachment://box.png',
|
||||
url: pokemon.serebiiURL
|
||||
})
|
||||
.setDescription(stripIndents`
|
||||
**${pokemon.genus}**
|
||||
${pokemon.entries.length ? pokemon.entries[Math.floor(Math.random() * pokemon.entries.length)] : 'No data.'}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
const genGames = [null, 'rb', 'gs', 'rs', 'dp', 'bw', 'xy', 'sm', 'ss', 'sv'];
|
||||
const games = {
|
||||
rb: 'Red/Blue',
|
||||
@@ -21,7 +21,7 @@ module.exports = class SmogonCommand extends Command {
|
||||
group: 'pokedex',
|
||||
memberName: 'smogon',
|
||||
description: 'Responds with the Smogon tiers for a Pokémon.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
credit: [
|
||||
{
|
||||
name: 'Pokémon',
|
||||
@@ -62,16 +62,20 @@ module.exports = class SmogonCommand extends Command {
|
||||
async run(msg, { pokemon }) {
|
||||
const fetchGames = genGames.slice(pokemon.generation, pokemon.missingno ? 2 : genGames.length);
|
||||
if (!pokemon.missingno) await pokemon.fetchSmogonTiers(...fetchGames);
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xED1C24)
|
||||
.setAuthor(`#${pokemon.displayID} - ${pokemon.name}`, 'attachment://box.png', pokemon.serebiiURL)
|
||||
.setAuthor({
|
||||
name: `#${pokemon.displayID} - ${pokemon.name}`,
|
||||
iconURL: 'attachment://box.png',
|
||||
url: pokemon.serebiiURL
|
||||
})
|
||||
.setThumbnail(pokemon.spriteImageURL);
|
||||
for (const game of fetchGames) {
|
||||
embed.addField(`❯ ${games[game]}`, `[${pokemon.smogonTiers[game].join('/')}](${pokemon.smogonURL(game)})`, true);
|
||||
}
|
||||
if (fetchGames.length % 3 !== 0 && fetchGames.length > 3) {
|
||||
for (let i = 0; i < 3 - (fetchGames.length % 3); i++) {
|
||||
embed.addField('\u200B', '\u200B', true);
|
||||
embed.addBlankField(true);
|
||||
}
|
||||
}
|
||||
return msg.channel.send({
|
||||
|
||||
Reference in New Issue
Block a user