This repository has been archived by the owner on May 3, 2018. It is now read-only.
/
gateway.go
71 lines (60 loc) · 1.62 KB
/
gateway.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package disgo
import "encoding/json"
type opCode int
const (
opDispatch opCode = iota
opHeartbeat
opIdentify
opStatusUpdate
opVoiceStateUpdate
opVoiceServerPing
opResume
opReconnect
opRequestGuildMembers
opInvalidSession
opHello
opHeartbeatAck
)
type gatewayGetResponse struct {
Url string `json:"Url"`
Shards int `json:"shards,omitempty"`
}
type gatewayFrame struct {
Op opCode `json:"op"`
Data interface{} `json:"d,omitempty"`
}
type receivedFrame struct {
Op opCode `json:"op"`
Data json.RawMessage `json:"d,omitempty"`
Sequence uint64 `json:"s,omitempty"`
EventName string `json:"t,omitempty"`
}
type helloPayload struct {
HeartbeatInterval int `json:"heartbeat_interval"`
Servers []string `json:"_trace"`
}
type identifyPayload struct {
Token string `json:"token"`
Properties propertiesPayload `json:"properties"`
Compress bool `json:"compress"`
LargeThreshold int `json:"large_threshold"`
Shard [2]int `json:"shard"`
}
type propertiesPayload struct {
OS string `json:"$os"`
Browser string `json:"$browser"`
Device string `json:"$device"`
Referrer string `json:"$referrer"`
ReferringDomain string `json:"$referring_domain"`
}
type resumePayload struct {
Token string `json:"token"`
SessionID string `json:"session_id"`
Sequence uint64 `json:"seq"`
}
type statusPayload struct {
Since uint64 `json:"since,omitempty"`
Game *Game `json:"game,omitempty"`
Status Status `json:"status"`
AFK bool `json:"afk"`
}