2021-08-27 15:03:47 +00:00
|
|
|
using System.Text.Json.Serialization;
|
2020-12-22 12:15:26 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
namespace Myriad.Gateway;
|
|
|
|
|
|
|
|
public record GatewayPacket
|
2020-12-22 12:15:26 +00:00
|
|
|
{
|
2021-11-27 02:10:56 +00:00
|
|
|
[JsonPropertyName("op")] public GatewayOpcode Opcode { get; init; }
|
|
|
|
[JsonPropertyName("d")] public object? Payload { get; init; }
|
2020-12-22 12:15:26 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
[JsonPropertyName("s")]
|
|
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
|
|
public int? Sequence { get; init; }
|
2020-12-22 12:15:26 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
[JsonPropertyName("t")]
|
|
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
|
|
public string? EventType { get; init; }
|
|
|
|
}
|
2020-12-22 12:15:26 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
public enum GatewayOpcode
|
|
|
|
{
|
|
|
|
Dispatch = 0,
|
|
|
|
Heartbeat = 1,
|
|
|
|
Identify = 2,
|
|
|
|
PresenceUpdate = 3,
|
|
|
|
VoiceStateUpdate = 4,
|
|
|
|
Resume = 6,
|
|
|
|
Reconnect = 7,
|
|
|
|
RequestGuildMembers = 8,
|
|
|
|
InvalidSession = 9,
|
|
|
|
Hello = 10,
|
|
|
|
HeartbeatAck = 11
|
2020-12-22 12:15:26 +00:00
|
|
|
}
|