aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/coopInvitation.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/cleaners/skyblock/coopInvitation.ts')
-rw-r--r--src/cleaners/skyblock/coopInvitation.ts19
1 files changed, 19 insertions, 0 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