1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-05-13 09:16:07 +03:00

More fixups

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-07-08 13:19:13 +05:00
parent 9d7ebb8fec
commit 20ffbbaafb
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
5 changed files with 29 additions and 17 deletions

View file

@ -146,7 +146,8 @@ public class GuildUpdateService : BackgroundService {
var storedEvent = data.ScheduledEvents[scheduledEvent.ID.Value];
if (storedEvent.Status == scheduledEvent.Status) {
if (DateTimeOffset.UtcNow >= scheduledEvent.ScheduledStartTime) {
if (scheduledEvent.Status is not GuildScheduledEventStatus.Active) {
if (data.Configuration.AutoStartEvents
&& scheduledEvent.Status is not GuildScheduledEventStatus.Active) {
var startResult = await _eventApi.ModifyGuildScheduledEventAsync(
guildId, scheduledEvent.ID,
status: GuildScheduledEventStatus.Active, ct: ct);
@ -155,9 +156,10 @@ public class GuildUpdateService : BackgroundService {
"Error in automatic scheduled event start request.\n{ErrorMessage}",
startResult.Error.Message);
}
} else if (DateTimeOffset.UtcNow
>= scheduledEvent.ScheduledStartTime - data.Configuration.EventEarlyNotificationOffset
&& !storedEvent.EarlyNotificationSent) {
} else if (data.Configuration.EventEarlyNotificationOffset != TimeSpan.Zero
&& !storedEvent.EarlyNotificationSent
&& DateTimeOffset.UtcNow
>= scheduledEvent.ScheduledStartTime - data.Configuration.EventEarlyNotificationOffset) {
var earlyResult = await SendScheduledEventUpdatedMessage(scheduledEvent, data, true, ct);
if (earlyResult.IsSuccess)
storedEvent.EarlyNotificationSent = true;