From 5e43bae03fe7c784b3ecb07ef0cf7ec00f418828 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Mon, 18 Jan 2021 18:18:02 -0500 Subject: [PATCH] Fix --- commands/pokedex/pokedex-stats.js | 2 +- structures/pokemon/Pokemon.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/commands/pokedex/pokedex-stats.js b/commands/pokedex/pokedex-stats.js index d14a8dbd..287d4b59 100644 --- a/commands/pokedex/pokedex-stats.js +++ b/commands/pokedex/pokedex-stats.js @@ -76,7 +76,7 @@ module.exports = class PokedexCommand extends Command { }; const embed = new MessageEmbed() .setColor(0xED1C24) - .setAuthor(`#${data.displayID} - ${data.name}`, data.boxImageURL, data.serebiiURL) + .setAuthor(`#${data.displayID} - ${data.name}`, data.formBoxImageURL(variety.id), data.serebiiURL) .setThumbnail(data.formSpriteImageURL(variety.id)) .addField(`❯ Base Stats (${variety.name || 'Base'} Form)`, stripIndents` \`HP: [${'█'.repeat(repeat.hp)}${' '.repeat(20 - repeat.hp)}]\` **${variety.stats.hp}** diff --git a/structures/pokemon/Pokemon.js b/structures/pokemon/Pokemon.js index 637c600f..1743cad8 100644 --- a/structures/pokemon/Pokemon.js +++ b/structures/pokemon/Pokemon.js @@ -121,6 +121,13 @@ module.exports = class Pokemon { return `https://www.serebii.net/pokedex-swsh/icon/${this.displayID}.png`; } + formBoxImageURL(variety) { + if (this.missingno) return missingno.box; + const found = this.varieties.find(vrity => variety ? vrity.id === variety.toLowerCase() : vrity.default); + const name = found.default ? '' : found.name.toLowerCase().split(' ').map(n => n.charAt(0)).join(''); + return `https://www.serebii.net/pokedex-swsh/icon/${this.displayID}${name ? `-${name}` : ''}.png`; + } + get serebiiURL() { if (this.missingno) return missingno.url; return `https://www.serebii.net/pokedex-swsh/${this.displayID}.shtml`;