Archived
1
0
Fork 0
This repository has been archived on 2024-05-21. You can view files and clone it, but cannot push or open issues or pull requests.
maki/Maki/Structures/Gateway/GatewayPayload.cs

39 lines
929 B
C#
Raw Normal View History

2017-05-14 12:02:51 +00:00
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;
}
}