diff options
Diffstat (limited to 'src/hypixel.ts')
-rw-r--r-- | src/hypixel.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/hypixel.ts b/src/hypixel.ts index 44a5bd8..59d09aa 100644 --- a/src/hypixel.ts +++ b/src/hypixel.ts @@ -14,9 +14,11 @@ import { AccountSchema, fetchAccount, queueUpdateDatabaseMember, - queueUpdateDatabaseProfile + queueUpdateDatabaseProfile, + removeDeletedProfilesFromLeaderboards } from './database.js' import { cleanElectionResponse, ElectionData } from './cleaners/skyblock/election.js' +import { cleanItemListResponse, ItemListData } from './cleaners/skyblock/itemList.js' import { CleanBasicMember, CleanMemberProfile } from './cleaners/skyblock/member.js' import { cleanSkyblockProfilesResponse } from './cleaners/skyblock/profiles.js' import { CleanPlayer, cleanPlayerResponse } from './cleaners/player.js' @@ -25,7 +27,6 @@ import typedHypixelApi from 'typed-hypixel-api' import * as cached from './hypixelCached.js' import { debug } from './index.js' import { WithId } from 'mongodb' -import { cleanItemListResponse, ItemListData } from './cleaners/skyblock/itemList.js' export type Included = 'profiles' | 'player' | 'stats' | 'inventories' | undefined @@ -142,12 +143,16 @@ export async function fetchUser({ user, uuid, username }: UserAny, included: Inc activeProfile = profile } } + + // we don't await so it happens in the background + removeDeletedProfilesFromLeaderboards(uuid, profilesData!.map(p => p.uuid)) } let websiteAccount: WithId<AccountSchema> | null = null if (websiteAccountPromise) websiteAccount = await websiteAccountPromise + return { player: playerData, profiles: profilesData ?? basicProfilesData, |