diff options
Diffstat (limited to 'src/cleaners')
-rw-r--r-- | src/cleaners/skyblock/coopInvitation.ts | 19 | ||||
-rw-r--r-- | src/cleaners/skyblock/member.ts | 8 |
2 files changed, 25 insertions, 2 deletions
diff --git a/src/cleaners/skyblock/coopInvitation.ts b/src/cleaners/skyblock/coopInvitation.ts new file mode 100644 index 0000000..80c92bb --- /dev/null +++ b/src/cleaners/skyblock/coopInvitation.ts @@ -0,0 +1,19 @@ +import typedHypixelApi from 'typed-hypixel-api' + +export interface CoopInvitation { + invitedTimestamp: number + invitedByUuid: string + accepted: boolean + acceptedTimestamp: number | null +} + +export function cleanCoopInvitation(data: typedHypixelApi.SkyBlockProfileMember): null | CoopInvitation { + if (!data.coop_invitation) + return null + return { + invitedTimestamp: data.coop_invitation.timestamp, + invitedByUuid: data.coop_invitation.invited_by, + accepted: data.coop_invitation.confirmed, + acceptedTimestamp: data.coop_invitation.confirmed_timestamp ?? null + } +}
\ No newline at end of file diff --git a/src/cleaners/skyblock/member.ts b/src/cleaners/skyblock/member.ts index 99a4376..2acbd26 100644 --- a/src/cleaners/skyblock/member.ts +++ b/src/cleaners/skyblock/member.ts @@ -1,3 +1,4 @@ +import { cleanCoopInvitation, CoopInvitation } from './coopInvitation.js' import { cleanCollections, Collection } from './collections.js' import { cleanInventories, Inventories } from './inventory.js' import { cleanFairySouls, FairySouls } from './fairysouls.js' @@ -11,12 +12,12 @@ import { cleanVisitedZones, Zone } from './zones.js' import { cleanSkills, Skill } from './skills.js' import * as cached from '../../hypixelCached.js' import typedHypixelApi from 'typed-hypixel-api' +import { cleanPets, PetsData } from './pets.js' +import { cleanHarp, HarpData } from './harp.js' import * as constants from '../../constants.js' import { Included } from '../../hypixel.js' import { CleanPlayer } from '../player.js' import { CleanRank } from '../rank.js' -import { cleanPets, Pet, PetsData } from './pets.js' -import { cleanHarp, HarpData } from './harp.js' export interface CleanBasicMember { uuid: string @@ -41,6 +42,7 @@ export interface CleanMember extends CleanBasicMember { slayers: SlayerData pets: PetsData harp: HarpData + coopInvitation: CoopInvitation | null /** Whether the user left the coop */ left: boolean } @@ -93,6 +95,7 @@ export async function cleanSkyBlockProfileMemberResponse(member: typedHypixelApi slayers: cleanSlayers(member), pets: await cleanPets(member), harp: await cleanHarp(member), + coopInvitation: cleanCoopInvitation(member), left: (player.profiles?.find(profile => profile.uuid === profileId) === undefined) ?? false } @@ -117,6 +120,7 @@ export interface CleanMemberProfilePlayer extends CleanPlayer { slayers: SlayerData pets: PetsData harp: HarpData + coopInvitation: CoopInvitation | null } export interface CleanMemberProfile { |