aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/profile.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/cleaners/skyblock/profile.ts')
-rw-r--r--src/cleaners/skyblock/profile.ts40
1 files changed, 4 insertions, 36 deletions
diff --git a/src/cleaners/skyblock/profile.ts b/src/cleaners/skyblock/profile.ts
index 8389a0d..742c9ed 100644
--- a/src/cleaners/skyblock/profile.ts
+++ b/src/cleaners/skyblock/profile.ts
@@ -10,8 +10,9 @@ export interface CleanProfile extends CleanBasicProfile {
export interface CleanFullProfile extends CleanProfile {
members: CleanMember[]
- bank?: Bank
+ bank: Bank
minions: CleanMinion[]
+ minion_count: number
}
/** Return a `CleanProfile` instead of a `CleanFullProfile`, useful when we need to get members but don't want to waste much ram */
@@ -59,7 +60,8 @@ export async function cleanSkyblockProfileResponse(data: any): Promise<CleanFull
name: data.cute_name,
members: cleanedMembers,
bank: cleanBank(data),
- minions
+ minions: minions,
+ minion_count: countUniqueMinions(minions)
}
}
@@ -71,37 +73,3 @@ export interface CleanBasicProfile {
name?: string
}
-// TODO: this should be moved and split up
-/**
- * Fetch a CleanMemberProfile from a user and string
- * This is safe to use many times as the results are cached!
- * @param user A username or uuid
- * @param profile A profile name or profile uuid
- */
-export async function fetchMemberProfile(user: string, profile: string): Promise<CleanMemberProfile> {
- const playerUuid = await cached.uuidFromUser(user)
- const profileUuid = await cached.fetchProfileUuid(user, profile)
-
- const player = await cached.fetchPlayer(playerUuid)
-
- const cleanProfile = await cached.fetchProfile(playerUuid, profileUuid)
-
- const member = cleanProfile.members.find(m => m.uuid === playerUuid)
-
- return {
- member: {
- // the profile name is in member rather than profile since they sometimes differ for each member
- profileName: cleanProfile.name,
- // add all the member data
- ...member,
- // add all other data relating to the hypixel player, such as username, rank, etc
- ...player
- },
- profile: {
- uuid: cleanProfile.uuid,
- bank: cleanProfile.bank,
- minions: cleanProfile.minions,
- minion_count: countUniqueMinions(cleanProfile.minions)
- }
- }
-}