mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-01-31 00:19:00 +03:00
Don't forget to remove scheduled event data when notification channel is not set (#133)
This PR fixes an issue that caused data of completed/cancelled scheduled events to never be collected if EventNotificationChannel wasn't set
This commit is contained in:
parent
f3da876d6d
commit
e283ba5a6d
1 changed files with 7 additions and 0 deletions
|
@ -317,6 +317,12 @@ public sealed class ScheduledEventUpdateService : BackgroundService
|
|||
private async Task<Result> SendScheduledEventCompletedMessage(ScheduledEventData eventData, GuildData data,
|
||||
CancellationToken ct)
|
||||
{
|
||||
if (GuildSettings.EventNotificationChannel.Get(data.Settings).Empty())
|
||||
{
|
||||
data.ScheduledEvents.Remove(eventData.Id);
|
||||
return Result.FromSuccess();
|
||||
}
|
||||
|
||||
var completedEmbed = new EmbedBuilder().WithTitle(string.Format(Messages.EventCompleted, eventData.Name))
|
||||
.WithDescription(
|
||||
string.Format(
|
||||
|
@ -349,6 +355,7 @@ public sealed class ScheduledEventUpdateService : BackgroundService
|
|||
{
|
||||
if (GuildSettings.EventNotificationChannel.Get(data.Settings).Empty())
|
||||
{
|
||||
data.ScheduledEvents.Remove(eventData.Id);
|
||||
return Result.FromSuccess();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue