forked from TeamInklings/Octobot
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,
|
private async Task<Result> SendScheduledEventCompletedMessage(ScheduledEventData eventData, GuildData data,
|
||||||
CancellationToken ct)
|
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))
|
var completedEmbed = new EmbedBuilder().WithTitle(string.Format(Messages.EventCompleted, eventData.Name))
|
||||||
.WithDescription(
|
.WithDescription(
|
||||||
string.Format(
|
string.Format(
|
||||||
|
@ -349,6 +355,7 @@ public sealed class ScheduledEventUpdateService : BackgroundService
|
||||||
{
|
{
|
||||||
if (GuildSettings.EventNotificationChannel.Get(data.Settings).Empty())
|
if (GuildSettings.EventNotificationChannel.Get(data.Settings).Empty())
|
||||||
{
|
{
|
||||||
|
data.ScheduledEvents.Remove(eventData.Id);
|
||||||
return Result.FromSuccess();
|
return Result.FromSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue