1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-20 00:43:36 +03:00

Do not update ScheduledEventData status if the status update code returns an unsuccessful Result

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-08-12 16:22:30 +05:00
parent dd31811dff
commit 8bfbcd263f
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF

View file

@ -79,9 +79,7 @@ public sealed class ScheduledEventUpdateService : BackgroundService
continue;
}
storedEvent.Status = scheduledEvent.Status;
var statusChangedResponseResult = storedEvent.Status switch
var statusChangedResponseResult = scheduledEvent.Status switch
{
GuildScheduledEventStatus.Scheduled =>
await SendScheduledEventCreatedMessage(scheduledEvent, data.Settings, ct),
@ -89,6 +87,11 @@ public sealed class ScheduledEventUpdateService : BackgroundService
await SendScheduledEventUpdatedMessage(scheduledEvent, data, ct),
_ => new ArgumentOutOfRangeError(nameof(scheduledEvent.Status))
};
if (statusChangedResponseResult.IsSuccess)
{
storedEvent.Status = scheduledEvent.Status;
}
failedResults.AddIfFailed(statusChangedResponseResult);
}