aboutsummaryrefslogtreecommitdiff
path: root/build/hypixelCached.js
diff options
context:
space:
mode:
authormat-1 <github@matdoes.dev>2021-03-02 16:28:17 +0000
committermat-1 <github@matdoes.dev>2021-03-02 16:28:17 +0000
commit67da5a4e42c94f3a6baddc3f15a8d18a407ca9ad (patch)
tree85e9d85a3bc20543e236200a77f488539969a39e /build/hypixelCached.js
parentee0ce21292dc53d11b5d6613465c502b0bb7a34a (diff)
downloadskyblock-api-67da5a4e42c94f3a6baddc3f15a8d18a407ca9ad.tar.gz
skyblock-api-67da5a4e42c94f3a6baddc3f15a8d18a407ca9ad.tar.bz2
skyblock-api-67da5a4e42c94f3a6baddc3f15a8d18a407ca9ad.zip
Compiled TS into JS
Diffstat (limited to 'build/hypixelCached.js')
-rw-r--r--build/hypixelCached.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/build/hypixelCached.js b/build/hypixelCached.js
index 3ef40ec..88397bf 100644
--- a/build/hypixelCached.js
+++ b/build/hypixelCached.js
@@ -90,6 +90,9 @@ async function uuidFromUser(user) {
if (usernameCache.has(util_1.undashUuid(user))) {
// check if the uuid is a key
const username = usernameCache.get(util_1.undashUuid(user));
+ // sometimes the username will be null, return that
+ if (username === null)
+ return username;
// if it has .then, then that means its a waitForCacheSet promise. This is done to prevent requests made while it is already requesting
if (username.then) {
const { key: uuid, value: _username } = await username;
@@ -205,6 +208,8 @@ exports.fetchSkyblockProfiles = fetchSkyblockProfiles;
/** Fetch an array of `BasicProfile`s */
async function fetchBasicProfiles(user) {
const playerUuid = await uuidFromUser(user);
+ if (!playerUuid)
+ return; // invalid player, just return
if (basicProfilesCache.has(playerUuid)) {
if (_1.debug)
console.log('Cache hit! fetchBasicProfiles', playerUuid);
@@ -235,6 +240,8 @@ async function fetchProfileUuid(user, profile) {
if (_1.debug)
console.log('Cache miss: fetchProfileUuid', user);
const profiles = await fetchBasicProfiles(user);
+ if (!profiles)
+ return; // user probably doesnt exist
const profileUuid = util_1.undashUuid(profile);
for (const p of profiles) {
if (p.name.toLowerCase() === profileUuid.toLowerCase())