diff options
author | mat <github@matdoes.dev> | 2022-04-09 19:55:00 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-04-09 19:55:00 -0500 |
commit | 066d722f19a4309f473ff72c64461a6846d3ab5a (patch) | |
tree | 0111dcb5524dea335f45fb5776db7ead4a73ab12 /src | |
parent | 6d08f7f8c91b31e27ff44162b7837751405ec67d (diff) | |
download | skyblock-api-066d722f19a4309f473ff72c64461a6846d3ab5a.tar.gz skyblock-api-066d722f19a4309f473ff72c64461a6846d3ab5a.tar.bz2 skyblock-api-066d722f19a4309f473ff72c64461a6846d3ab5a.zip |
include profile mode in /player/[player]
Diffstat (limited to 'src')
-rw-r--r-- | src/cleaners/skyblock/profile.ts | 7 | ||||
-rw-r--r-- | src/hypixel.ts | 2 | ||||
-rw-r--r-- | src/hypixelCached.ts | 6 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/cleaners/skyblock/profile.ts b/src/cleaners/skyblock/profile.ts index 48daa24..ebe5c47 100644 --- a/src/cleaners/skyblock/profile.ts +++ b/src/cleaners/skyblock/profile.ts @@ -7,7 +7,8 @@ import { Bank, cleanBank } from './bank.js' import { cleanGameMode, GameMode } from './gameMode.js' export interface CleanProfile extends CleanBasicProfile { - members?: CleanBasicMember[] + members: CleanBasicMember[] + mode: GameMode } export interface CleanFullProfile extends CleanProfile { @@ -16,7 +17,6 @@ export interface CleanFullProfile extends CleanProfile { minions: CleanMinion[] minionCount: number maxUniqueMinions: number - mode: GameMode } export interface CleanFullProfileBasicMembers extends CleanProfile { @@ -25,7 +25,6 @@ export interface CleanFullProfileBasicMembers extends CleanProfile { minions: CleanMinion[] minionCount: number maxUniqueMinions: number - mode: GameMode } /** Return a `CleanProfile` instead of a `CleanFullProfile`, useful when we need to get members but don't want to waste much ram */ @@ -46,6 +45,7 @@ export async function cleanSkyblockProfileResponseLighter(data: typedHypixelApi. uuid: data.profile_id, name: 'cute_name' in data ? data.cute_name : undefined, members: cleanedMembers, + mode: cleanGameMode(data) } } @@ -83,6 +83,7 @@ export async function cleanSkyblockProfileResponse<O extends ApiOptions>( uuid: profileId, name: 'cute_name' in data ? data.cute_name : undefined, members: cleanedMembers, + mode: cleanGameMode(data) } // we have to do this because of the basic checking typing return cleanProfile as any diff --git a/src/hypixel.ts b/src/hypixel.ts index b886090..549f593 100644 --- a/src/hypixel.ts +++ b/src/hypixel.ts @@ -86,7 +86,7 @@ export interface UserAny { export interface CleanUser { player: CleanPlayer | null - profiles?: CleanProfile[] + profiles?: CleanProfile[] | CleanBasicProfile[] activeProfile?: string online?: boolean customization?: AccountCustomization diff --git a/src/hypixelCached.ts b/src/hypixelCached.ts index a2600f2..e8195fb 100644 --- a/src/hypixelCached.ts +++ b/src/hypixelCached.ts @@ -248,7 +248,8 @@ export async function fetchSkyblockProfiles(playerUuid: string): Promise<CleanPr rank: m.rank, left: m.left } - }) + }), + mode: profile.mode } basicProfiles.push(basicProfile) } @@ -381,7 +382,8 @@ export async function fetchBasicProfileFromUuid(profileUuid: string): Promise<Cl firstJoin: m.firstJoin, rank: m.rank, })), - name: profile.name + name: profile.name, + mode: profile.mode } } // TODO: cache this |