diff options
Diffstat (limited to 'src/cleaners/skyblock/profiles.ts')
-rw-r--r-- | src/cleaners/skyblock/profiles.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/cleaners/skyblock/profiles.ts b/src/cleaners/skyblock/profiles.ts new file mode 100644 index 0000000..c942a14 --- /dev/null +++ b/src/cleaners/skyblock/profiles.ts @@ -0,0 +1,24 @@ +import { HypixelPlayerStatsSkyBlockProfiles } from "../../hypixelApi" +import { CleanBasicProfile, CleanProfile, cleanSkyblockProfileResponseLighter } from "./profile" + +export function cleanPlayerSkyblockProfiles(rawProfiles: HypixelPlayerStatsSkyBlockProfiles): CleanBasicProfile[] { + let profiles: CleanBasicProfile[] = [] + for (const profile of Object.values(rawProfiles)) { + profiles.push({ + uuid: profile.profile_id, + name: profile.cute_name + }) + } + console.log('cleanPlayerSkyblockProfiles', profiles) + return profiles +} + +/** Convert an array of raw profiles into clean profiles */ +export async function cleanSkyblockProfilesResponse(data: any[]): Promise<CleanProfile[]> { + const cleanedProfiles: CleanProfile[] = [] + for (const profile of data) { + let cleanedProfile = await cleanSkyblockProfileResponseLighter(profile) + cleanedProfiles.push(cleanedProfile) + } + return cleanedProfiles +} |