mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-18 13:56:25 +02:00
Support Gen 8 Pokemon
This commit is contained in:
@@ -4,7 +4,7 @@ const request = require('node-superfetch');
|
|||||||
const { list } = require('../../util/Util');
|
const { list } = require('../../util/Util');
|
||||||
const { silhouette } = require('../../util/Canvas');
|
const { silhouette } = require('../../util/Canvas');
|
||||||
const difficulties = ['easy', 'hard'];
|
const difficulties = ['easy', 'hard'];
|
||||||
const pokemonCount = 807;
|
const pokemonCount = 893;
|
||||||
|
|
||||||
module.exports = class WhosThatPokemonCommand extends Command {
|
module.exports = class WhosThatPokemonCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "119.29.2",
|
"version": "119.29.3",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -6,12 +6,19 @@ module.exports = class Pokemon {
|
|||||||
constructor(store, data) {
|
constructor(store, data) {
|
||||||
this.store = store;
|
this.store = store;
|
||||||
this.id = data.id;
|
this.id = data.id;
|
||||||
this.name = data.names.find(entry => entry.language.name === 'en').name;
|
const slugName = firstUpperCase(data.name).replace(new RegExp(`${this.slug}-?`, 'i'), '').replace(/-/g, ' ');
|
||||||
|
this.name = data.names.length
|
||||||
|
? data.names.find(entry => entry.language.name === 'en').name
|
||||||
|
: slugName;
|
||||||
this.entries = removeDuplicates(data.flavor_text_entries
|
this.entries = removeDuplicates(data.flavor_text_entries
|
||||||
.filter(entry => entry.language.name === 'en')
|
.filter(entry => entry.language.name === 'en')
|
||||||
.map(entry => entry.flavor_text.replace(/\n|\f|\r/g, ' ')));
|
.map(entry => entry.flavor_text.replace(/\n|\f|\r/g, ' ')));
|
||||||
this.names = data.names.map(entry => ({ name: entry.name, language: entry.language.name }));
|
this.names = data.names.length
|
||||||
this.genus = `The ${data.genera.filter(entry => entry.language.name === 'en')[0].genus}`;
|
? data.names.map(entry => ({ name: entry.name, language: entry.language.name }))
|
||||||
|
: [slugName];
|
||||||
|
this.genus = data.genera.length
|
||||||
|
? `The ${data.genera.filter(entry => entry.language.name === 'en')[0].genus}`
|
||||||
|
: 'Genus Unknown';
|
||||||
this.varieties = data.varieties.map(variety => {
|
this.varieties = data.varieties.map(variety => {
|
||||||
const name = firstUpperCase(variety.pokemon.name
|
const name = firstUpperCase(variety.pokemon.name
|
||||||
.replace(new RegExp(`${this.slug}-?`, 'i'), '')
|
.replace(new RegExp(`${this.slug}-?`, 'i'), '')
|
||||||
@@ -24,7 +31,10 @@ module.exports = class Pokemon {
|
|||||||
types: data.missingno ? variety.types : []
|
types: data.missingno ? variety.types : []
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
this.chain = { url: data.evolution_chain.url, data: data.missingno ? missingno.chain : [] };
|
this.chain = {
|
||||||
|
url: data.evolution_chain ? data.evolution_chain.url : null,
|
||||||
|
data: data.missingno ? missingno.chain : data.evolution_chain ? [] : [data.id]
|
||||||
|
};
|
||||||
this.typesCached = data.missingno || false;
|
this.typesCached = data.missingno || false;
|
||||||
this.missingno = data.missingno || false;
|
this.missingno = data.missingno || false;
|
||||||
}
|
}
|
||||||
@@ -40,17 +50,17 @@ module.exports = class Pokemon {
|
|||||||
|
|
||||||
get spriteImageURL() {
|
get spriteImageURL() {
|
||||||
if (this.missingno) return missingno.sprite;
|
if (this.missingno) return missingno.sprite;
|
||||||
return `https://www.serebii.net/sunmoon/pokemon/${this.displayID}.png`;
|
return `https://www.serebii.net/swordshield/pokemon/${this.displayID}.png`;
|
||||||
}
|
}
|
||||||
|
|
||||||
get boxImageURL() {
|
get boxImageURL() {
|
||||||
if (this.missingno) return missingno.box;
|
if (this.missingno) return missingno.box;
|
||||||
return `https://www.serebii.net/pokedex-sm/icon/${this.displayID}.png`;
|
return `https://www.serebii.net/pokedex-swsh/icon/${this.displayID}.png`;
|
||||||
}
|
}
|
||||||
|
|
||||||
get serebiiURL() {
|
get serebiiURL() {
|
||||||
if (this.missingno) return missingno.url;
|
if (this.missingno) return missingno.url;
|
||||||
return `https://www.serebii.net/pokedex-sm/${this.displayID}.shtml`;
|
return `https://www.serebii.net/pokedex-swsh/${this.displayID}.shtml`;
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchTypes() {
|
async fetchTypes() {
|
||||||
|
|||||||
Reference in New Issue
Block a user