From ca19168cf49ee4cce27b57547c3e2d8a0a12a780 Mon Sep 17 00:00:00 2001 From: kenobi Date: Thu, 13 Jul 2023 22:45:28 +0200 Subject: [PATCH] add early abort message to announce watch party --- server/events/announceManualWatchparty.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/events/announceManualWatchparty.ts b/server/events/announceManualWatchparty.ts index acaccf6..b4f38ab 100644 --- a/server/events/announceManualWatchparty.ts +++ b/server/events/announceManualWatchparty.ts @@ -32,7 +32,11 @@ export async function execute(event: GuildScheduledEvent) { return } - const message = `[Watchparty] https://discord.com/events/${event.guildId}/${event.id} \nHey <@&${config.bot.announcement_role}>, wir gucken ${event.name} ${createDateStringFromEvent(event, guildId, requestId)}` + if (!event.scheduledStartAt) { + logger.error('Event has no start date, bailing out') + return + } + const message = `[Watchparty] https://discord.com/events/${event.guildId}/${event.id} \nHey <@&${config.bot.announcement_role}>, wir gucken ${event.name} ${createDateStringFromEvent(event.scheduledStartAt, guildId, requestId)}` channel.send(message) } else {