aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/hypixel.ts6
-rw-r--r--src/hypixelCached.ts2
2 files changed, 7 insertions, 1 deletions
diff --git a/src/hypixel.ts b/src/hypixel.ts
index e2d0e6b..6c19a69 100644
--- a/src/hypixel.ts
+++ b/src/hypixel.ts
@@ -75,7 +75,11 @@ export async function fetchUser({ user, uuid, username }: UserAny, included: Inc
if (!uuid) {
// 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')
diff --git a/src/hypixelCached.ts b/src/hypixelCached.ts
index 056f50e..ae544a2 100644
--- a/src/hypixelCached.ts
+++ b/src/hypixelCached.ts
@@ -65,6 +65,7 @@ export async function uuidFromUser(user: string): Promise<string> {
// 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 = undashUuid(uuid)
@@ -103,6 +104,7 @@ export async function fetchPlayer(user: string): Promise<CleanPlayer> {
// clone in case it gets modified somehow later
const cleanPlayerClone = Object.assign({}, cleanPlayer)
playerCache.set(playerUuid, cleanPlayerClone)
+ usernameCache.set(playerUuid, cleanPlayerClone.username)
return cleanPlayer
}