mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-16 00:12:32 +02:00
Add Pokedex Ability and Move
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
|
||||
module.exports = class PokedexAbilityCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'pokedex-ability',
|
||||
aliases: ['pokemon-ability', 'pokémon-ability', 'pokédex-ability', 'pkmn-ability'],
|
||||
group: 'pokedex',
|
||||
memberName: 'pokedex-ability',
|
||||
description: 'Searches the Pokédex for a Pokémon ability.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Pokémon',
|
||||
url: 'https://www.pokemon.com/us/',
|
||||
reason: 'Original Game'
|
||||
},
|
||||
{
|
||||
name: 'PokéAPI',
|
||||
url: 'https://pokeapi.co/',
|
||||
reason: 'API'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'ability',
|
||||
prompt: 'What ability would you like to get information on?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { ability }) {
|
||||
try {
|
||||
const data = await this.client.pokemon.abilities.fetch(ability);
|
||||
if (!data) return msg.say('Could not find any results.');
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0xED1C24)
|
||||
.setTitle(data.name)
|
||||
.setDescription(data.description);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
|
||||
module.exports = class PokedexMoveCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'pokedex-move',
|
||||
aliases: ['pokemon-move', 'pokémon-move', 'pokédex-move', 'pkmn-move'],
|
||||
group: 'pokedex',
|
||||
memberName: 'pokedex-move',
|
||||
description: 'Searches the Pokédex for a Pokémon move.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Pokémon',
|
||||
url: 'https://www.pokemon.com/us/',
|
||||
reason: 'Original Game'
|
||||
},
|
||||
{
|
||||
name: 'PokéAPI',
|
||||
url: 'https://pokeapi.co/',
|
||||
reason: 'API'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'move',
|
||||
prompt: 'What move would you like to get information on?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { move }) {
|
||||
try {
|
||||
const data = await this.client.pokemon.moves.fetch(move);
|
||||
if (!data) return msg.say('Could not find any results.');
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0xED1C24)
|
||||
.setTitle(data.name)
|
||||
.setDescription(data.cleanDescription)
|
||||
.addField('❯ Accuracy', `${data.accuracy}%`, true)
|
||||
.addField('❯ Power', data.power, true)
|
||||
.addField('❯ PP', data.pp, true)
|
||||
.addField('❯ Type', data.type, true)
|
||||
.addField('❯ Contest Type', data.contestType, true)
|
||||
.addField('❯ Class', data.class, true);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -61,7 +61,7 @@ module.exports = class PokedexMovesetCommand extends Command {
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0xED1C24)
|
||||
.setAuthor(`#${data.displayID} - ${data.name}`, data.boxImageURL, data.serebiiURL)
|
||||
.setDescription(data.moveSet.map(move => `**Level ${move.level}:** ${move.name}`).join('\n'))
|
||||
.setDescription(data.moveSet.map(move => `**Level ${move.level}:** ${move.move.name}`).join('\n'))
|
||||
.setThumbnail(data.spriteImageURL)
|
||||
.setFooter(`Moveset data taken from ${versions[data.moveSetVersion]}.`);
|
||||
return msg.embed(embed);
|
||||
|
||||
@@ -88,7 +88,7 @@ module.exports = class PokedexCommand extends Command {
|
||||
\`-----------------------------------\`
|
||||
\`Total: [${'█'.repeat(repeat.total)}${' '.repeat(20 - repeat.total)}]\` **${statTotal}**
|
||||
`)
|
||||
.addField('❯ Abilities', variety.abilities.join('/'))
|
||||
.addField('❯ Abilities', variety.abilities.map(ability => ability.name).join('/'))
|
||||
.addField('❯ Other Forms', stripIndents`
|
||||
_Use ${this.usage(`${data.id} <form>`)} to get stats for another form._
|
||||
|
||||
|
||||
Reference in New Issue
Block a user