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

Add a JSON deserialization constructor for ScheduledEventData (#92)

This PR fixes an exception that would occur when deserialization of
ScheduledEventData would be attempted. The exception is fixed by
providing a constructor containing all properties and adding the
`[JsonConstructor]` attribute.

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-08-15 10:23:58 +05:00 committed by GitHub
parent ef5410b7bb
commit 0bf61ecf39
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 5 deletions

View file

@ -55,7 +55,7 @@ public class GuildLoadedResponder : IResponder<IGuildCreate>
if (!data.ScheduledEvents.TryGetValue(schEvent.ID.Value, out var eventData))
{
data.ScheduledEvents.Add(schEvent.ID.Value, new ScheduledEventData(schEvent.ID.Value,
schEvent.Name, schEvent.Status, schEvent.ScheduledStartTime));
schEvent.Name, schEvent.ScheduledStartTime, schEvent.Status));
continue;
}

View file

@ -25,7 +25,7 @@ public class ScheduledEventCreatedResponder : IResponder<IGuildScheduledEventCre
var data = await _guildData.GetData(gatewayEvent.GuildID, ct);
data.ScheduledEvents.Add(gatewayEvent.ID.Value,
new ScheduledEventData(gatewayEvent.ID.Value,
gatewayEvent.Name, gatewayEvent.Status, gatewayEvent.ScheduledStartTime));
gatewayEvent.Name, gatewayEvent.ScheduledStartTime, gatewayEvent.Status));
return Result.FromSuccess();
}