-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.go
125 lines (104 loc) · 3.27 KB
/
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
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package client
type rpcVersion string
type rpcCommand string
type ActivityType int
type ActivityJoinRequestReply int
type ActivityActionType int
const (
RPCVersion1 rpcVersion = "1"
)
const (
PLAYING ActivityType = iota
STREAMING
LISTENING
WATCHING
CUSTOM
COMPETING
)
const (
NO ActivityJoinRequestReply = iota
YES
IGNORE
)
const (
JOIN ActivityActionType = iota
SPECTATE
)
const (
DISPATCH rpcCommand = "DISPATCH"
AUTHORIZE rpcCommand = "AUTHORIZE"
AUTHENTICATE rpcCommand = "AUTHENTICATE"
GET_GUILD rpcCommand = "GET_GUILD"
GET_GUILDS rpcCommand = "GET_GUILDS"
GET_CHANNEL rpcCommand = "GET_CHANNEL"
GET_CHANNELS rpcCommand = "GET_CHANNELS"
SUBSCRIBE rpcCommand = "SUBSCRIBE"
UNSUBSCRIBE rpcCommand = "UNSUBSCRIBE"
SET_USER_VOICE_SETTINGS rpcCommand = "SET_USER_VOICE_SETTINGS"
SELECT_VOICE_CHANNEL rpcCommand = "SELECT_VOICE_CHANNEL"
GET_SELECTED_VOICE_CHANNEL rpcCommand = "GET_SELECTED_VOICE_CHANNEL"
SELECT_TEXT_CHANNEL rpcCommand = "SELECT_TEXT_CHANNEL"
GET_VOICE_SETTINGS rpcCommand = "GET_VOICE_SETTINGS"
SET_VOICE_SETTINGS rpcCommand = "SET_VOICE_SETTINGS"
SET_CERTIFIED_DEVICES rpcCommand = "SET_CERTIFIED_DEVICES"
SET_ACTIVITY rpcCommand = "SET_ACTIVITY"
SEND_ACTIVITY_JOIN_INVITE rpcCommand = "SEND_ACTIVITY_JOIN_INVITE"
CLOSE_ACTIVITY_REQUEST rpcCommand = "CLOSE_ACTIVITY_REQUEST"
)
type Handshake struct {
V rpcVersion `json:"v"`
ClientId string `json:"client_id"`
}
type Frame struct {
Cmd rpcCommand `json:"cmd"`
Args Args `json:"args"`
Nonce string `json:"nonce,omitempty"`
}
type Args struct {
Pid int `json:"pid"`
Activity *Activity `json:"activity,omitempty"`
}
type User struct {
Id int64 `json:"id"`
Username string `json:"username"`
Discriminator string `json:"discriminator"`
Avatar string `json:"avatar"`
Bot bool `json:"bot"`
}
type Activity struct {
State string `json:"state,omitempty"`
Details string `json:"details,omitempty"`
Timestamps *ActivityTimestamps `json:"timestamps,omitempty"`
Assets *ActivityAssets `json:"assets,omitempty"`
Party *ActivityParty `json:"party,omitempty"`
Secrets *ActivitySecrets `json:"secrets,omitempty"`
Buttons []*ActivityButton `json:"buttons,omitempty"`
Instance bool `json:"instance,omitempty"`
}
type ActivityTimestamps struct {
Start int64 `json:"start"`
End int64 `json:"end,omitempty"`
}
type ActivityAssets struct {
LargeImage string `json:"large_image,omitempty"`
LargeText string `json:"large_text,omitempty"`
SmallImage string `json:"small_image,omitempty"`
SmallText string `json:"small_text,omitempty"`
}
type ActivityParty struct {
ID string `json:"id"`
Size *PartySize `json:"size"`
}
type PartySize struct {
Current int32 `json:"current"`
Max int32 `json:"max,omitempty"`
}
type ActivitySecrets struct {
Match string `json:"match,omitempty"`
Join string `json:"join,omitempty"`
Spectate string `json:"spectate,omitempty"`
}
type ActivityButton struct {
Label string `json:"label"`
Url string `json:"url"`
}