aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/coopInvitation.ts
blob: 80c92bbe14c9fa216ade6eb4f0e7c0e3090339a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
	}
}