Pokemon cries

This commit is contained in:
Dragon Fire
2020-10-30 12:30:34 -04:00
parent a11d9f02c3
commit 5daacf8f16
6 changed files with 40 additions and 2 deletions
+12
View File
@@ -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;
}
}
};