mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-20 00:43:36 +03:00
We're moving! --------- Signed-off-by: Macintosh II <mctaylxrs@outlook.com> Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com> Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
30 lines
1 KiB
C#
30 lines
1 KiB
C#
using JetBrains.Annotations;
|
|
using Octobot.Services;
|
|
using Remora.Discord.API.Abstractions.Gateway.Events;
|
|
using Remora.Discord.Gateway.Responders;
|
|
using Remora.Results;
|
|
|
|
namespace Octobot.Responders;
|
|
|
|
[UsedImplicitly]
|
|
public class ScheduledEventUpdatedResponder : IResponder<IGuildScheduledEventUpdate>
|
|
{
|
|
private readonly GuildDataService _guildData;
|
|
|
|
public ScheduledEventUpdatedResponder(GuildDataService guildData)
|
|
{
|
|
_guildData = guildData;
|
|
}
|
|
|
|
public async Task<Result> RespondAsync(IGuildScheduledEventUpdate gatewayEvent, CancellationToken ct = default)
|
|
{
|
|
var data = await _guildData.GetData(gatewayEvent.GuildID, ct);
|
|
var eventData = data.ScheduledEvents[gatewayEvent.ID.Value];
|
|
eventData.Name = gatewayEvent.Name;
|
|
eventData.ScheduledStartTime = gatewayEvent.ScheduledStartTime;
|
|
eventData.ScheduleOnStatusUpdated = eventData.Status != gatewayEvent.Status;
|
|
eventData.Status = gatewayEvent.Status;
|
|
|
|
return Result.FromSuccess();
|
|
}
|
|
}
|