diff options
author | mat-1 <github@matdoes.dev> | 2021-02-15 20:45:19 +0000 |
---|---|---|
committer | mat-1 <github@matdoes.dev> | 2021-02-15 20:45:19 +0000 |
commit | 90b3fdb471c9ddf61e683e3a09b6fac84b85a9da (patch) | |
tree | 6c0ddd9f72750886e888157f9a42b9a23427a708 | |
parent | 17c9057a71b3bdd2ea458b050ed77dfb4aebe25a (diff) | |
download | skyblock-api-90b3fdb471c9ddf61e683e3a09b6fac84b85a9da.tar.gz skyblock-api-90b3fdb471c9ddf61e683e3a09b6fac84b85a9da.tar.bz2 skyblock-api-90b3fdb471c9ddf61e683e3a09b6fac84b85a9da.zip |
Compiled TS into JS
-rw-r--r-- | build/hypixel.js | 4 | ||||
-rw-r--r-- | build/hypixelCached.js | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/build/hypixel.js b/build/hypixel.js index ee81fb5..ace7540 100644 --- a/build/hypixel.js +++ b/build/hypixel.js @@ -63,6 +63,10 @@ async function fetchUser({ user, uuid, username }, included = ['player']) { // If the uuid isn't provided, get it uuid = await cached.uuidFromUser(user || username); } + if (!uuid) { + // the user doesn't exist. + return null; + } const includePlayers = included.includes('player'); const includeProfiles = included.includes('profiles'); let profilesData; diff --git a/build/hypixelCached.js b/build/hypixelCached.js index 660bab4..15a1cec 100644 --- a/build/hypixelCached.js +++ b/build/hypixelCached.js @@ -77,6 +77,8 @@ async function uuidFromUser(user) { } // not cached, actually fetch mojang api now let { uuid, username } = await mojang.mojangDataFromUser(user); + if (!uuid) + return; // remove dashes from the uuid so its more normal uuid = util_1.undashUuid(uuid); usernameCache.set(uuid, username); @@ -109,6 +111,7 @@ async function fetchPlayer(user) { // clone in case it gets modified somehow later const cleanPlayerClone = Object.assign({}, cleanPlayer); playerCache.set(playerUuid, cleanPlayerClone); + usernameCache.set(playerUuid, cleanPlayerClone.username); return cleanPlayer; } exports.fetchPlayer = fetchPlayer; |