mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-13 00:09:08 +02:00
Split Pokedex Stats
This commit is contained in:
@@ -261,7 +261,7 @@ in the appropriate channel's topic to use it.
|
|||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
Total: 577
|
Total: 578
|
||||||
|
|
||||||
### Utility:
|
### Utility:
|
||||||
|
|
||||||
@@ -540,6 +540,7 @@ Total: 577
|
|||||||
* **pokedex-image:** Responds with the image of a Pokémon.
|
* **pokedex-image:** Responds with the image of a Pokémon.
|
||||||
* **pokedex-location:** Responds with the location data for a Pokémon.
|
* **pokedex-location:** Responds with the location data for a Pokémon.
|
||||||
* **pokedex-moveset:** Responds with the moveset for a Pokémon.
|
* **pokedex-moveset:** Responds with the moveset for a Pokémon.
|
||||||
|
* **pokedex-stats:** Responds with the stats for a Pokémon.
|
||||||
* **pokedex:** Searches the Pokédex for a Pokémon.
|
* **pokedex:** Searches the Pokédex for a Pokémon.
|
||||||
|
|
||||||
### Analyzers:
|
### Analyzers:
|
||||||
@@ -1567,10 +1568,11 @@ here.
|
|||||||
* pokemon-fusion (Images)
|
* pokemon-fusion (Images)
|
||||||
- [PokéAPI](https://pokeapi.co/)
|
- [PokéAPI](https://pokeapi.co/)
|
||||||
* pokedex (API)
|
* pokedex (API)
|
||||||
|
* pokedex-cry (API)
|
||||||
* pokedex-image (API)
|
* pokedex-image (API)
|
||||||
* pokedex-location (API)
|
* pokedex-location (API)
|
||||||
* pokedex-moveset (API)
|
* pokedex-moveset (API)
|
||||||
* pokemon-cry (API)
|
* pokedex-stats (API)
|
||||||
* whos-that-pokemon (API)
|
* whos-that-pokemon (API)
|
||||||
* whos-that-pokemon-cry (API)
|
* whos-that-pokemon-cry (API)
|
||||||
- [Pokémon](https://www.pokemon.com/us/)
|
- [Pokémon](https://www.pokemon.com/us/)
|
||||||
@@ -1579,10 +1581,11 @@ here.
|
|||||||
* hat (Ash Hat Original Anime)
|
* hat (Ash Hat Original Anime)
|
||||||
* name-rater (Sprite)
|
* name-rater (Sprite)
|
||||||
* pokedex (Images, Original Game)
|
* pokedex (Images, Original Game)
|
||||||
|
* pokedex-cry (Original Game)
|
||||||
* pokedex-image (Images, Original Game)
|
* pokedex-image (Images, Original Game)
|
||||||
* pokedex-location (Images, Original Game)
|
* pokedex-location (Images, Original Game)
|
||||||
* pokedex-moveset (Images, Original Game)
|
* pokedex-moveset (Images, Original Game)
|
||||||
* pokemon-cry (Original Game)
|
* pokedex-stats (Images, Original Game)
|
||||||
* pokemon-fusion (Original Game)
|
* pokemon-fusion (Original Game)
|
||||||
* whos-that-pokemon (Images, Original Game)
|
* whos-that-pokemon (Images, Original Game)
|
||||||
* whos-that-pokemon-cry (Images, Original Game)
|
* whos-that-pokemon-cry (Images, Original Game)
|
||||||
@@ -1590,7 +1593,7 @@ here.
|
|||||||
* wynaut (Image, Original Anime)
|
* wynaut (Image, Original Anime)
|
||||||
- [Pokémon Showdown](https://play.pokemonshowdown.com/)
|
- [Pokémon Showdown](https://play.pokemonshowdown.com/)
|
||||||
* pokedex ([Cry Sound Effects (Meltan and Melmetal)](https://play.pokemonshowdown.com/audio/cries/))
|
* pokedex ([Cry Sound Effects (Meltan and Melmetal)](https://play.pokemonshowdown.com/audio/cries/))
|
||||||
* pokemon-cry ([Cry Sound Effects (Meltan and Melmetal)](https://play.pokemonshowdown.com/audio/cries/))
|
* pokedex-cry ([Cry Sound Effects (Meltan and Melmetal)](https://play.pokemonshowdown.com/audio/cries/))
|
||||||
* whos-that-pokemon ([Cry Sound Effects (Meltan and Melmetal)](https://play.pokemonshowdown.com/audio/cries/))
|
* whos-that-pokemon ([Cry Sound Effects (Meltan and Melmetal)](https://play.pokemonshowdown.com/audio/cries/))
|
||||||
* whos-that-pokemon-cry ([Cry Sound Effects (Meltan and Melmetal)](https://play.pokemonshowdown.com/audio/cries/))
|
* whos-that-pokemon-cry ([Cry Sound Effects (Meltan and Melmetal)](https://play.pokemonshowdown.com/audio/cries/))
|
||||||
- [Pornhub](https://www.pornhub.com/)
|
- [Pornhub](https://www.pornhub.com/)
|
||||||
@@ -1665,6 +1668,7 @@ here.
|
|||||||
* pokedex-image (Images)
|
* pokedex-image (Images)
|
||||||
* pokedex-location (Images)
|
* pokedex-location (Images)
|
||||||
* pokedex-moveset (Images)
|
* pokedex-moveset (Images)
|
||||||
|
* pokedex-stats (Images)
|
||||||
* whos-that-pokemon (Images)
|
* whos-that-pokemon (Images)
|
||||||
* whos-that-pokemon-cry (Images)
|
* whos-that-pokemon-cry (Images)
|
||||||
- [ShareFonts.net](https://www.wfonts.com/)
|
- [ShareFonts.net](https://www.wfonts.com/)
|
||||||
@@ -1747,8 +1751,8 @@ here.
|
|||||||
- [The Sounds Resource](https://www.sounds-resource.com/)
|
- [The Sounds Resource](https://www.sounds-resource.com/)
|
||||||
* pokedex ([Cry Sound Effects (Gen 8)](https://www.sounds-resource.com/nintendo_switch/pokemonswordshield/))
|
* pokedex ([Cry Sound Effects (Gen 8)](https://www.sounds-resource.com/nintendo_switch/pokemonswordshield/))
|
||||||
* pokedex ([Cry Sound Effects (Gen 1-7)](https://www.sounds-resource.com/3ds/pokemonultrasunultramoon/))
|
* pokedex ([Cry Sound Effects (Gen 1-7)](https://www.sounds-resource.com/3ds/pokemonultrasunultramoon/))
|
||||||
* pokemon-cry ([Cry Sound Effects (Gen 8)](https://www.sounds-resource.com/nintendo_switch/pokemonswordshield/))
|
* pokedex-cry ([Cry Sound Effects (Gen 8)](https://www.sounds-resource.com/nintendo_switch/pokemonswordshield/))
|
||||||
* pokemon-cry ([Cry Sound Effects (Gen 1-7)](https://www.sounds-resource.com/3ds/pokemonultrasunultramoon/))
|
* pokedex-cry ([Cry Sound Effects (Gen 1-7)](https://www.sounds-resource.com/3ds/pokemonultrasunultramoon/))
|
||||||
* whos-that-pokemon ([Cry Sound Effects (Gen 8)](https://www.sounds-resource.com/nintendo_switch/pokemonswordshield/))
|
* whos-that-pokemon ([Cry Sound Effects (Gen 8)](https://www.sounds-resource.com/nintendo_switch/pokemonswordshield/))
|
||||||
* whos-that-pokemon ([Cry Sound Effects (Gen 1-7)](https://www.sounds-resource.com/3ds/pokemonultrasunultramoon/))
|
* whos-that-pokemon ([Cry Sound Effects (Gen 1-7)](https://www.sounds-resource.com/3ds/pokemonultrasunultramoon/))
|
||||||
* whos-that-pokemon-cry ([Cry Sound Effects (Gen 8)](https://www.sounds-resource.com/nintendo_switch/pokemonswordshield/))
|
* whos-that-pokemon-cry ([Cry Sound Effects (Gen 8)](https://www.sounds-resource.com/nintendo_switch/pokemonswordshield/))
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
const Command = require('../../structures/Command');
|
||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
const { stripIndents } = require('common-tags');
|
||||||
|
const { arrayEquals } = require('../../util/Util');
|
||||||
|
|
||||||
|
module.exports = class PokedexCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'pokedex-stats',
|
||||||
|
aliases: ['pokemon-stats', 'pokémon-stats', 'pokédex-stats', 'pkmn-stats'],
|
||||||
|
group: 'pokedex',
|
||||||
|
memberName: 'pokedex',
|
||||||
|
description: 'Responds with the stats for a Pokémon.',
|
||||||
|
clientPermissions: ['EMBED_LINKS'],
|
||||||
|
credit: [
|
||||||
|
{
|
||||||
|
name: 'Pokémon',
|
||||||
|
url: 'https://www.pokemon.com/us/',
|
||||||
|
reason: 'Images, Original Game'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'PokéAPI',
|
||||||
|
url: 'https://pokeapi.co/',
|
||||||
|
reason: 'API'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Serebii.net',
|
||||||
|
url: 'https://www.serebii.net/index2.shtml',
|
||||||
|
reason: 'Images'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'pokemon',
|
||||||
|
prompt: 'What Pokémon would you like to get information on?',
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, { pokemon }) {
|
||||||
|
try {
|
||||||
|
const data = await this.client.pokemon.fetch(pokemon);
|
||||||
|
if (!data) return msg.say('Could not find any results.');
|
||||||
|
if (!data.gameDataCached) await data.fetchGameData();
|
||||||
|
const defaultVariety = data.varieties.find(variety => variety.default);
|
||||||
|
const abilitiesShown = data.varieties.filter(variety => {
|
||||||
|
if (variety.default) return true;
|
||||||
|
return !arrayEquals(defaultVariety.abilities, variety.abilities);
|
||||||
|
});
|
||||||
|
const repeat = {
|
||||||
|
hp: Math.round((data.stats.hp / 255) * 10) * 2,
|
||||||
|
atk: Math.round((data.stats.atk / 255) * 10) * 2,
|
||||||
|
def: Math.round((data.stats.def / 255) * 10) * 2,
|
||||||
|
sAtk: Math.round((data.stats.sAtk / 255) * 10) * 2,
|
||||||
|
sDef: Math.round((data.stats.sDef / 255) * 10) * 2,
|
||||||
|
spd: Math.round((data.stats.spd / 255) * 10) * 2,
|
||||||
|
total: Math.round((data.baseStatTotal / 720) * 10) * 2
|
||||||
|
};
|
||||||
|
const embed = new MessageEmbed()
|
||||||
|
.setColor(0xED1C24)
|
||||||
|
.setAuthor(`#${data.displayID} - ${data.name}`, data.boxImageURL, data.serebiiURL)
|
||||||
|
.setDescription(stripIndents`
|
||||||
|
**${data.genus}**
|
||||||
|
${data.entries[Math.floor(Math.random() * data.entries.length)]}
|
||||||
|
`)
|
||||||
|
.setThumbnail(data.spriteImageURL)
|
||||||
|
.addField('❯ Base Stats (Base Form)', stripIndents`
|
||||||
|
\`HP: [${'█'.repeat(repeat.hp)}${' '.repeat(20 - repeat.hp)}]\` **${data.stats.hp}**
|
||||||
|
\`Attack: [${'█'.repeat(repeat.atk)}${' '.repeat(20 - repeat.atk)}]\` **${data.stats.atk}**
|
||||||
|
\`Defense: [${'█'.repeat(repeat.def)}${' '.repeat(20 - repeat.def)}]\` **${data.stats.def}**
|
||||||
|
\`Sp. Attack: [${'█'.repeat(repeat.sAtk)}${' '.repeat(20 - repeat.sAtk)}]\` **${data.stats.sAtk}**
|
||||||
|
\`Sp. Defense: [${'█'.repeat(repeat.sDef)}${' '.repeat(20 - repeat.sDef)}]\` **${data.stats.sDef}**
|
||||||
|
\`Speed: [${'█'.repeat(repeat.spd)}${' '.repeat(20 - repeat.spd)}]\` **${data.stats.spd}**
|
||||||
|
\`-----------------------------------\`
|
||||||
|
\`Total: [${'█'.repeat(repeat.total)}${' '.repeat(20 - repeat.total)}]\` **${data.baseStatTotal}**
|
||||||
|
`)
|
||||||
|
.addField('❯ Abilities', abilitiesShown.map(variety => {
|
||||||
|
const showParens = variety.name && abilitiesShown.length > 1;
|
||||||
|
return `${variety.abilities.join('/')}${showParens ? ` (${variety.name})` : ''}`;
|
||||||
|
}).join('\n'));
|
||||||
|
return msg.embed(embed);
|
||||||
|
} catch (err) {
|
||||||
|
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -68,19 +68,6 @@ module.exports = class PokedexCommand extends Command {
|
|||||||
if (variety.default) return true;
|
if (variety.default) return true;
|
||||||
return !arrayEquals(defaultVariety.types, variety.types);
|
return !arrayEquals(defaultVariety.types, variety.types);
|
||||||
});
|
});
|
||||||
const abilitiesShown = data.varieties.filter(variety => {
|
|
||||||
if (variety.default) return true;
|
|
||||||
return !arrayEquals(defaultVariety.abilities, variety.abilities);
|
|
||||||
});
|
|
||||||
const repeat = {
|
|
||||||
hp: Math.round((data.stats.hp / 255) * 10) * 2,
|
|
||||||
atk: Math.round((data.stats.atk / 255) * 10) * 2,
|
|
||||||
def: Math.round((data.stats.def / 255) * 10) * 2,
|
|
||||||
sAtk: Math.round((data.stats.sAtk / 255) * 10) * 2,
|
|
||||||
sDef: Math.round((data.stats.sDef / 255) * 10) * 2,
|
|
||||||
spd: Math.round((data.stats.spd / 255) * 10) * 2,
|
|
||||||
total: Math.round((data.baseStatTotal / 720) * 10) * 2
|
|
||||||
};
|
|
||||||
const feet = Math.floor(data.height / 12);
|
const feet = Math.floor(data.height / 12);
|
||||||
const embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(0xED1C24)
|
.setColor(0xED1C24)
|
||||||
@@ -110,20 +97,6 @@ module.exports = class PokedexCommand extends Command {
|
|||||||
if (found.id === data.id) return `**${found.name}**`;
|
if (found.id === data.id) return `**${found.name}**`;
|
||||||
return found.name;
|
return found.name;
|
||||||
}).join(' -> '))
|
}).join(' -> '))
|
||||||
.addField('❯ Base Stats (Base Form)', stripIndents`
|
|
||||||
\`HP: [${'█'.repeat(repeat.hp)}${' '.repeat(20 - repeat.hp)}]\` **${data.stats.hp}**
|
|
||||||
\`Attack: [${'█'.repeat(repeat.atk)}${' '.repeat(20 - repeat.atk)}]\` **${data.stats.atk}**
|
|
||||||
\`Defense: [${'█'.repeat(repeat.def)}${' '.repeat(20 - repeat.def)}]\` **${data.stats.def}**
|
|
||||||
\`Sp. Attack: [${'█'.repeat(repeat.sAtk)}${' '.repeat(20 - repeat.sAtk)}]\` **${data.stats.sAtk}**
|
|
||||||
\`Sp. Defense: [${'█'.repeat(repeat.sDef)}${' '.repeat(20 - repeat.sDef)}]\` **${data.stats.sDef}**
|
|
||||||
\`Speed: [${'█'.repeat(repeat.spd)}${' '.repeat(20 - repeat.spd)}]\` **${data.stats.spd}**
|
|
||||||
\`-----------------------------------\`
|
|
||||||
\`Total: [${'█'.repeat(repeat.total)}${' '.repeat(20 - repeat.total)}]\` **${data.baseStatTotal}**
|
|
||||||
`)
|
|
||||||
.addField('❯ Abilities', abilitiesShown.map(variety => {
|
|
||||||
const showParens = variety.name && abilitiesShown.length > 1;
|
|
||||||
return `${variety.abilities.join('/')}${showParens ? ` (${variety.name})` : ''}`;
|
|
||||||
}).join('\n'))
|
|
||||||
.addField('❯ Held Items',
|
.addField('❯ Held Items',
|
||||||
data.heldItems.length ? data.heldItems.map(item => `${item.name} (${item.rarity}%)`).join('\n') : 'None')
|
data.heldItems.length ? data.heldItems.map(item => `${item.name} (${item.rarity}%)`).join('\n') : 'None')
|
||||||
.addField('❯ Gender Rate',
|
.addField('❯ Gender Rate',
|
||||||
@@ -131,13 +104,18 @@ module.exports = class PokedexCommand extends Command {
|
|||||||
if (data.cry) {
|
if (data.cry) {
|
||||||
const connection = msg.guild ? this.client.voice.connections.get(msg.guild.id) : null;
|
const connection = msg.guild ? this.client.voice.connections.get(msg.guild.id) : null;
|
||||||
const moveUsage = this.client.registry.commands.get('pokedex-moveset').usage();
|
const moveUsage = this.client.registry.commands.get('pokedex-moveset').usage();
|
||||||
|
const statsUsage = this.client.registry.commands.get('pokedex-stats').usage();
|
||||||
if (connection) {
|
if (connection) {
|
||||||
embed.setFooter(`Use ${moveUsage} to get the Pokémon's moveset.`);
|
embed.setFooter(stripIndents`
|
||||||
|
Use ${statsUsage} to get the Pokémon's stats.
|
||||||
|
Use ${moveUsage} to get the Pokémon's moveset.
|
||||||
|
`);
|
||||||
connection.play(data.cry);
|
connection.play(data.cry);
|
||||||
await reactIfAble(msg, this.client.user, '🔉');
|
await reactIfAble(msg, this.client.user, '🔉');
|
||||||
} else {
|
} else {
|
||||||
const usage = this.client.registry.commands.get('join').usage();
|
const usage = this.client.registry.commands.get('join').usage();
|
||||||
embed.setFooter(stripIndents`
|
embed.setFooter(stripIndents`
|
||||||
|
Usage ${statsUsage} to get the Pokémon's stats.
|
||||||
Use ${moveUsage} to get the Pokémon's moveset.
|
Use ${moveUsage} to get the Pokémon's moveset.
|
||||||
Join a voice channel and use ${usage} to hear the Pokémon's cry.
|
Join a voice channel and use ${usage} to hear the Pokémon's cry.
|
||||||
`);
|
`);
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "126.5.1",
|
"version": "126.6.0",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user