mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-19 16:33: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:
parent
dd31811dff
commit
8bfbcd263f
1 changed files with 6 additions and 3 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue