diff options
| author | Mel <einebeere@gmail.com> | 2022-04-04 00:05:12 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2022-04-04 00:05:12 +0200 |
| commit | 4cbe353d824d5064ee6f72f4693ee3c759b50e0a (patch) | |
| tree | 9e0d47d6098e87b913a44348cf3d9811d992f190 /pkg/discord/payloads.go | |
| parent | dfeef2aad6fb25eadc13c12e1caea7160bfe6c3e (diff) | |
| download | jinx-4cbe353d824d5064ee6f72f4693ee3c759b50e0a.tar.zst jinx-4cbe353d824d5064ee6f72f4693ee3c759b50e0a.zip | |
Successful Identify
Diffstat (limited to 'pkg/discord/payloads.go')
| -rw-r--r-- | pkg/discord/payloads.go | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/pkg/discord/payloads.go b/pkg/discord/payloads.go new file mode 100644 index 0000000..d7ab6d4 --- /dev/null +++ b/pkg/discord/payloads.go @@ -0,0 +1,47 @@ +package discord + +type GatewayOp uint8 + +const ( + GATEWAY_OP_DISPATCH GatewayOp = 0 + GATEWAY_OP_HEARTBEAT GatewayOp = 1 + GATEWAY_OP_IDENTIFY GatewayOp = 2 + GATEWAY_OP_PRESENCE_UPDATE GatewayOp = 3 + GATEWAY_OP_VOICE_STATE_UPDATE GatewayOp = 4 + GATEWAY_OP_RESUME GatewayOp = 6 + GATEWAY_OP_RECONNECT GatewayOp = 7 + GATEWAY_OP_REQUEST_GUILD_MEMBERS GatewayOp = 8 + GATEWAY_OP_INVALID_SESSION GatewayOp = 9 + GATEWAY_OP_HELLO GatewayOp = 10 + GATEWAY_OP_HEARTBEAT_ACK GatewayOp = 11 +) + +type GatewayPayload[D any] struct { + Op GatewayOp `json:"op"` + Data D `json:"d,omitempty"` + Sequence uint64 `json:"s,omitempty"` + EventName string `json:"t,omitempty"` +} + +type GatewayIdentifyMsg struct { + Token string `json:"token"` + Intents uint64 `json:"intents"` + Properties GatewayIdentifyProperties `json:"properties"` +} +type GatewayHelloMsg struct { + HeartbeatInterval uint64 `json:"heartbeat_interval"` +} + +type GatewayReadyMsg struct { + Version uint64 `json:"v"` + User User `json:"user"` + Guilds []Guild `json:"guilds"` + SessionID string `json:"session_id"` + Shard []int `json:"shard"` +} + +type GatewayIdentifyProperties struct { + OS string `json:"$os"` + Browser string `json:"$browser"` + Device string `json:"$device"` +} |
