39 lines
929 B
C#
39 lines
929 B
C#
|
using Maki.Gateway;
|
|||
|
using Newtonsoft.Json;
|
|||
|
using Newtonsoft.Json.Linq;
|
|||
|
|
|||
|
namespace Maki.Structures.Gateway
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Discord Gateway Payload structure
|
|||
|
/// </summary>
|
|||
|
internal struct GatewayPayload
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// opcode for the payload
|
|||
|
/// </summary>
|
|||
|
[JsonProperty("op")]
|
|||
|
public GatewayOPCode OPCode;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// event data, can be an object or an integer
|
|||
|
/// </summary>
|
|||
|
[JsonProperty("d")]
|
|||
|
public object Data;
|
|||
|
|
|||
|
public T DataAs<T>() => (Data as JObject).ToObject<T>();
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// sequence number, used for resuming sessions and heartbeats
|
|||
|
/// </summary>
|
|||
|
[JsonProperty("s")]
|
|||
|
public int? Sequence;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// the event name for this payload
|
|||
|
/// </summary>
|
|||
|
[JsonProperty("t")]
|
|||
|
public string Name;
|
|||
|
}
|
|||
|
}
|