From d0d663d2bbf58440b958e23eaceb220071f4a54f Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Sat, 12 Aug 2023 19:18:30 +0500 Subject: [PATCH] Fix a crash in scheduled event early notification (#83) This PR fixes a fatal crash that occurs when the bot tries to send an early notification for a scheduled event. An exception is thrown by `string#Format` when the argument list provided doesn't match the argument list in the template. This is fixed by correcting the template and the argument list Signed-off-by: Octol1ttle --- locale/Messages.resx | 2 +- locale/Messages.ru.resx | 2 +- locale/Messages.tt-ru.resx | 2 +- src/Services/Update/ScheduledEventUpdateService.cs | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/locale/Messages.resx b/locale/Messages.resx index ddb0f06..cf3de28 100644 --- a/locale/Messages.resx +++ b/locale/Messages.resx @@ -433,7 +433,7 @@ You cannot unmute this user! - {0}Event {1} will start <t:{2}:R>! + Event "{0}" will start {1}! Early event start notification offset diff --git a/locale/Messages.ru.resx b/locale/Messages.ru.resx index 0cb87fb..d4729d1 100644 --- a/locale/Messages.ru.resx +++ b/locale/Messages.ru.resx @@ -430,7 +430,7 @@ Я не могу вернуть из мута этого пользователя! - {0}Событие {1} начнется <t:{2}:R>! + Событие "{0}" начнется {1}! Офсет отправки преждевременного уведомления о начале события diff --git a/locale/Messages.tt-ru.resx b/locale/Messages.tt-ru.resx index 5b0b798..212ad16 100644 --- a/locale/Messages.tt-ru.resx +++ b/locale/Messages.tt-ru.resx @@ -433,7 +433,7 @@ я не могу его раззамутить... - {0}движуха {1} начнется <t:{2}:R>! + движуха "{0}" начнется {1}! заранее пнуть в минутах до начала движухи diff --git a/src/Services/Update/ScheduledEventUpdateService.cs b/src/Services/Update/ScheduledEventUpdateService.cs index 3d57f09..faa8bab 100644 --- a/src/Services/Update/ScheduledEventUpdateService.cs +++ b/src/Services/Update/ScheduledEventUpdateService.cs @@ -359,7 +359,9 @@ public sealed class ScheduledEventUpdateService : BackgroundService } var earlyResult = new EmbedBuilder() - .WithSmallTitle(string.Format(Messages.EventEarlyNotification, scheduledEvent.Name), currentUser) + .WithSmallTitle( + string.Format(Messages.EventEarlyNotification, scheduledEvent.Name, + Markdown.Timestamp(scheduledEvent.ScheduledStartTime, TimestampStyle.RelativeTime)), currentUser) .WithColour(ColorsList.Default) .WithCurrentTimestamp() .Build();