diff options
| author | Mel <einebeere@gmail.com> | 2022-04-08 12:54:09 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2022-04-08 12:54:09 +0200 |
| commit | 24f175df385466e04ef21d153713d2ecf3a9733b (patch) | |
| tree | 1c5c6253a22804697462d3fb9e9f3189af15c286 /pkg/discord/gateway/payloads.go | |
| parent | 18389cf659c40cebc4572924929abfcec3c6b875 (diff) | |
| download | jinx-24f175df385466e04ef21d153713d2ecf3a9733b.tar.zst jinx-24f175df385466e04ef21d153713d2ecf3a9733b.zip | |
Subdivide discord into packages
Diffstat (limited to 'pkg/discord/gateway/payloads.go')
| -rw-r--r-- | pkg/discord/gateway/payloads.go | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/pkg/discord/gateway/payloads.go b/pkg/discord/gateway/payloads.go new file mode 100644 index 0000000..8da894f --- /dev/null +++ b/pkg/discord/gateway/payloads.go @@ -0,0 +1,54 @@ +package gateway + +import ( + "jinx/pkg/discord/entities" +) + +type GatewayOp uint8 + +const ( + OP_DISPATCH GatewayOp = 0 + OP_HEARTBEAT GatewayOp = 1 + OP_IDENTIFY GatewayOp = 2 + OP_PRESENCE_UPDATE GatewayOp = 3 + OP_VOICE_STATE_UPDATE GatewayOp = 4 + OP_RESUME GatewayOp = 6 + OP_RECONNECT GatewayOp = 7 + OP_REQUEST_GUILD_MEMBERS GatewayOp = 8 + OP_INVALID_SESSION GatewayOp = 9 + OP_HELLO GatewayOp = 10 + OP_HEARTBEAT_ACK GatewayOp = 11 +) + +type Payload[D any] struct { + Op GatewayOp `json:"op"` + Data D `json:"d,omitempty"` + Sequence uint64 `json:"s,omitempty"` + EventName string `json:"t,omitempty"` +} + +type IdentifyCmd struct { + Token string `json:"token"` + Intents uint64 `json:"intents"` + Properties IdentifyProperties `json:"properties"` +} + +type HelloEvent struct { + HeartbeatInterval uint64 `json:"heartbeat_interval"` +} + +type ReadyEvent struct { + Version uint64 `json:"v"` + User entities.User `json:"user"` + Guilds []entities.Guild `json:"guilds"` + SessionID string `json:"session_id"` + Shard []int `json:"shard"` +} + +type MessageCreateEvent entities.Message + +type IdentifyProperties struct { + OS string `json:"$os"` + Browser string `json:"$browser"` + Device string `json:"$device"` +} |
