/
types.go
42 lines (36 loc) · 880 Bytes
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package gateway
import (
"github.com/BOOMfinity/bfcord/discord"
"github.com/BOOMfinity/bfcord/gateway/events"
"github.com/segmentio/encoding/json"
)
type OpCode uint8
const (
DispatchOp OpCode = iota
HeartbeatOp
IdentifyOp
PresenceUpdateOp
VoiceStateUpdateOp
ResumeOp OpCode = iota + 1
ReconnectOp
RequestGuildMembersOp
InvalidSessionOp
HelloOp
HeartbeatAckOp
)
type PresenceUpdate struct {
Since *uint64 `json:"since"`
Status discord.PresenceStatus `json:"status"`
Activities []discord.Activity `json:"activities"`
AFK bool `json:"afk"`
}
type Payload struct {
Event events.Event `json:"t"`
Data json.RawMessage `json:"d"`
Seq uint64 `json:"s"`
Shard uint16 `json:"-"`
OP OpCode `json:"op"`
}
type helloData struct {
Interval int `json:"heartbeat_interval"`
}