From 9bfbefbf7d272b091420a742f94c0cd9f282d149 Mon Sep 17 00:00:00 2001 From: Nathaniel Moschkin Date: Tue, 31 Oct 2023 13:32:00 -0400 Subject: [PATCH] Change end date to start date for upcoming events. --- src/commands/profile.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/commands/profile.ts b/src/commands/profile.ts index 90f73f7..16e2c3d 100644 --- a/src/commands/profile.ts +++ b/src/commands/profile.ts @@ -226,10 +226,20 @@ async function asyncHandler(message: Message, guildConfig?: Definitions.GuildCon // Remove from smallbonus the highbonus crew smallbonus = smallbonus.filter((entry) => !highbonus.includes(entry)); + event.endDate ??= new Date(); - let reply = `Event ending on *${toTimestamp(event.endDate)}*\n\nHigh bonus crew: ${ + + let reply = ""; + if (event.startDate && event.startDate.getTime() > (new Date()).getTime()) { + reply = `Event starting on *${toTimestamp(event.startDate)}*`; + } + else { + reply = `Event ending on *${toTimestamp(event.endDate)}*`; + } + reply += `\n\nHigh bonus crew: ${ highbonus.length === 0 ? 'NONE' : highbonus.map((entry) => entry ? eventCrewFormat(entry, profileData) : '').join(', ') }\n\n`; + reply += `Small bonus crew: ${ smallbonus.length === 0 ? 'NONE'