diff options
author | mat <github@matdoes.dev> | 2022-04-09 13:19:20 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-04-09 13:19:20 -0500 |
commit | 3d4d9e51880aa665541e335bcd5dfa8c9bce2299 (patch) | |
tree | 97670a92bf1e41160c53458621bc65454bcbd0a8 /src/hypixelCached.ts | |
parent | aca2096adb2568c4c19fff96c293aa9a625002be (diff) | |
download | skyblock-api-3d4d9e51880aa665541e335bcd5dfa8c9bce2299.tar.gz skyblock-api-3d4d9e51880aa665541e335bcd5dfa8c9bce2299.tar.bz2 skyblock-api-3d4d9e51880aa665541e335bcd5dfa8c9bce2299.zip |
return whole player in coopInvitation
Diffstat (limited to 'src/hypixelCached.ts')
-rw-r--r-- | src/hypixelCached.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/hypixelCached.ts b/src/hypixelCached.ts index 6e634ef..3c703f6 100644 --- a/src/hypixelCached.ts +++ b/src/hypixelCached.ts @@ -198,13 +198,17 @@ export async function fetchPlayer(user: string): Promise<CleanPlayer | null> { } /** Fetch a player without their profiles. This is heavily cached. */ -export async function fetchBasicPlayer(user: string): Promise<CleanPlayer | null> { +export async function fetchBasicPlayer(user: string, includeClaimed: boolean = true): Promise<CleanPlayer | null> { const playerUuid = await uuidFromUser(user) if (!playerUuid) return null - if (basicPlayerCache.has(playerUuid)) - return basicPlayerCache.get(playerUuid)! + if (basicPlayerCache.has(playerUuid)) { + const player = basicPlayerCache.get(playerUuid)! + if (!includeClaimed) + delete player.claimed + return player + } const player = await fetchPlayer(playerUuid) if (!player) { @@ -213,6 +217,8 @@ export async function fetchBasicPlayer(user: string): Promise<CleanPlayer | null } delete player.profiles + if (!includeClaimed) + delete player.claimed return player } |