aboutsummaryrefslogtreecommitdiff
path: root/src/hypixelCached.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-04-09 14:47:46 -0500
committermat <github@matdoes.dev>2022-04-09 14:47:46 -0500
commit208d98cc47c956f3b4449ccc525a8f073d92d6c6 (patch)
tree61c227cc888757f5c7cb88a17c002caf5808812a /src/hypixelCached.ts
parent3d4d9e51880aa665541e335bcd5dfa8c9bce2299 (diff)
downloadskyblock-api-208d98cc47c956f3b4449ccc525a8f073d92d6c6.tar.gz
skyblock-api-208d98cc47c956f3b4449ccc525a8f073d92d6c6.tar.bz2
skyblock-api-208d98cc47c956f3b4449ccc525a8f073d92d6c6.zip
Allow viewing profiles of removed members
Diffstat (limited to 'src/hypixelCached.ts')
-rw-r--r--src/hypixelCached.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/hypixelCached.ts b/src/hypixelCached.ts
index 3c703f6..a2600f2 100644
--- a/src/hypixelCached.ts
+++ b/src/hypixelCached.ts
@@ -313,6 +313,10 @@ export async function fetchProfileUuid(user: string, profile: string): Promise<s
if (!profiles) return null // user probably doesnt exist
const profileUuid = undashUuid(profile)
+ if (isUuid(profileUuid)) {
+ // if the profile is already a uuid, just return it
+ return profileUuid
+ }
for (const p of profiles) {
if (p.name?.toLowerCase() === profileUuid.toLowerCase())
@@ -411,11 +415,11 @@ export async function fetchProfileName(user: string, profile: string): Promise<s
if (!basicProfiles) return null
- let profileName: string | null = null
+ let profileName = profile // we default to the profile uuid provided
for (const basicProfile of basicProfiles)
- if (basicProfile.uuid === playerUuid)
- profileName = basicProfile.name ?? null
+ if (basicProfile.uuid === playerUuid && basicProfile.name)
+ profileName = basicProfile.name
profileNameCache.set(`${playerUuid}.${profileUuid}`, profileName)
return profileName