mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-13 15:58:06 +02:00
Local Pokemon Cries
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
const { removeDuplicates, firstUpperCase } = require('../../util/Util');
|
||||
const missingno = require('../../assets/json/missingno');
|
||||
|
||||
@@ -37,7 +38,7 @@ module.exports = class Pokemon {
|
||||
};
|
||||
this.typesCached = data.missingno || false;
|
||||
this.missingno = data.missingno || false;
|
||||
this.cry = null;
|
||||
this.cry = path.join(__dirname, '..', '..', 'assets', 'sounds', 'pokedex', `${data.id}.wav`);
|
||||
}
|
||||
|
||||
get displayID() {
|
||||
@@ -109,16 +110,4 @@ module.exports = class Pokemon {
|
||||
}
|
||||
return this.chain.data;
|
||||
}
|
||||
|
||||
async fetchCry() {
|
||||
if (this.cry) return this.cry;
|
||||
if (this.missingno) return null;
|
||||
try {
|
||||
const { body } = await request.get(`https://pokemoncries.com/cries/${this.id}.mp3`);
|
||||
this.cry = body;
|
||||
return this.cry;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user