Support More Pokemon

This commit is contained in:
Dragon Fire
2020-11-26 08:40:44 -05:00
parent a22af5768e
commit 4df75d669a
6 changed files with 26 additions and 18 deletions
+4 -2
View File
@@ -19,7 +19,7 @@ module.exports = class Pokemon {
: [{ name: slugName, language: 'en' }];
this.genus = data.genera.length
? `The ${data.genera.filter(entry => entry.language.name === 'en')[0].genus}`
: 'Galar Native';
: 'Undiscovered Pokémon';
this.varieties = data.varieties.map(variety => {
const name = firstUpperCase(variety.pokemon.name
.replace(new RegExp(`${this.slug}-?`, 'i'), '')
@@ -38,7 +38,9 @@ module.exports = class Pokemon {
};
this.typesCached = data.missingno || false;
this.missingno = data.missingno || false;
this.cry = path.join(__dirname, '..', '..', 'assets', 'sounds', 'pokedex', `${data.id}.wav`);
this.cry = data.id > store.pokemonCountWithCry
? null
: path.join(__dirname, '..', '..', 'assets', 'sounds', 'pokedex', `${data.id}.wav`);
}
get displayID() {
+7
View File
@@ -4,6 +4,13 @@ const Pokemon = require('./Pokemon');
const missingno = require('../../assets/json/missingno');
module.exports = class PokemonStore extends Collection {
constructor(options) {
super(options);
this.pokemonCount = 897;
this.pokemonCountWithCry = 893;
}
async fetch(query) {
query = this.makeSlug(query);
if (!query) return null;