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 <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-08-12 19:18:30 +05:00 committed by GitHub
parent 488a1eec0c
commit d0d663d2bb
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 4 deletions

View file

@ -433,7 +433,7 @@
<value>You cannot unmute this user!</value>
</data>
<data name="EventEarlyNotification" xml:space="preserve">
<value>{0}Event {1} will start &lt;t:{2}:R&gt;!</value>
<value>Event "{0}" will start {1}!</value>
</data>
<data name="SettingsEventEarlyNotificationOffset" xml:space="preserve">
<value>Early event start notification offset</value>

View file

@ -430,7 +430,7 @@
<value>Я не могу вернуть из мута этого пользователя!</value>
</data>
<data name="EventEarlyNotification" xml:space="preserve">
<value>{0}Событие {1} начнется &lt;t:{2}:R&gt;!</value>
<value>Событие "{0}" начнется {1}!</value>
</data>
<data name="SettingsEventEarlyNotificationOffset" xml:space="preserve">
<value>Офсет отправки преждевременного уведомления о начале события</value>

View file

@ -433,7 +433,7 @@
<value>я не могу его раззамутить...</value>
</data>
<data name="EventEarlyNotification" xml:space="preserve">
<value>{0}движуха {1} начнется &lt;t:{2}:R&gt;!</value>
<value>движуха "{0}" начнется {1}!</value>
</data>
<data name="SettingsEventEarlyNotificationOffset" xml:space="preserve">
<value>заранее пнуть в минутах до начала движухи</value>

View file

@ -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();