diff options
author | mat <github@matdoes.dev> | 2022-03-27 19:38:44 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-03-27 19:38:44 -0500 |
commit | 0a31ac6943aef19fbc63b25163ecb3b4a3c9f81b (patch) | |
tree | e04388c055ad445b070f35745355f2d109b35d2c /src/cleaners/skyblock/coopInvitation.ts | |
parent | ac72f729ba04c3ed8523e16c86bf8f61e3271fa7 (diff) | |
download | skyblock-api-0a31ac6943aef19fbc63b25163ecb3b4a3c9f81b.tar.gz skyblock-api-0a31ac6943aef19fbc63b25163ecb3b4a3c9f81b.tar.bz2 skyblock-api-0a31ac6943aef19fbc63b25163ecb3b4a3c9f81b.zip |
Add coop invitation
Diffstat (limited to 'src/cleaners/skyblock/coopInvitation.ts')
-rw-r--r-- | src/cleaners/skyblock/coopInvitation.ts | 19 |
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 |