mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 14:19:56 +02:00
Pokemon cries
This commit is contained in:
@@ -37,6 +37,7 @@ module.exports = class Pokemon {
|
||||
};
|
||||
this.typesCached = data.missingno || false;
|
||||
this.missingno = data.missingno || false;
|
||||
this.cry = null;
|
||||
}
|
||||
|
||||
get displayID() {
|
||||
@@ -108,4 +109,15 @@ module.exports = class Pokemon {
|
||||
}
|
||||
return this.chain.data;
|
||||
}
|
||||
|
||||
async fetchCry() {
|
||||
if (this.cry) return this.cry;
|
||||
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