diff options
Diffstat (limited to 'src/cleaners/skyblock')
-rw-r--r-- | src/cleaners/skyblock/coopInvitation.ts | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/cleaners/skyblock/coopInvitation.ts b/src/cleaners/skyblock/coopInvitation.ts index 0188772..031135b 100644 --- a/src/cleaners/skyblock/coopInvitation.ts +++ b/src/cleaners/skyblock/coopInvitation.ts @@ -14,10 +14,20 @@ export async function cleanCoopInvitation(data: typedHypixelApi.SkyBlockProfileM if (!data.coop_invitation) return null + let invitedTimestamp = data.coop_invitation.timestamp + let acceptedTimestamp = data.coop_invitation.confirmed_timestamp ?? null + + // the accepted timestamp should always be greater, otherwise swap + if (acceptedTimestamp !== null && invitedTimestamp > acceptedTimestamp) { + let temp = invitedTimestamp + invitedTimestamp = acceptedTimestamp + acceptedTimestamp = temp + } + return { - invitedTimestamp: data.coop_invitation.timestamp, + invitedTimestamp, invitedBy: await cached.fetchBasicPlayer(data.coop_invitation.invited_by, false), accepted: data.coop_invitation.confirmed, - acceptedTimestamp: data.coop_invitation.confirmed_timestamp ?? null + acceptedTimestamp } }
\ No newline at end of file |