forked from bwmarrin/discordgo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
events.go
238 lines (195 loc) · 6.05 KB
/
events.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
package discordgo
import (
"encoding/json"
"time"
)
// This file contains all the possible structs that can be
// handled by AddHandler/EventHandler.
// DO NOT ADD ANYTHING BUT EVENT HANDLER STRUCTS TO THIS FILE.
//go:generate go run tools/cmd/eventhandlers/main.go
// Connect is the data for a Connect event.
// This is a sythetic event and is not dispatched by Discord.
type Connect struct{}
// Disconnect is the data for a Disconnect event.
// This is a sythetic event and is not dispatched by Discord.
type Disconnect struct{}
// RateLimit is the data for a RateLimit event.
// This is a sythetic event and is not dispatched by Discord.
type RateLimit struct {
*TooManyRequests
URL string
}
// Event provides a basic initial struct for all websocket events.
type Event struct {
Operation int `json:"op"`
Sequence int `json:"s"`
Type string `json:"t"`
RawData json.RawMessage `json:"d"`
// Struct contains one of the other types in this file.
Struct interface{} `json:"-"`
}
// A Ready stores all data for the websocket READY event.
type Ready struct {
Version int `json:"v"`
SessionID string `json:"session_id"`
HeartbeatInterval time.Duration `json:"heartbeat_interval"`
User *User `json:"user"`
ReadState []*ReadState `json:"read_state"`
PrivateChannels []*Channel `json:"private_channels"`
Guilds []*Guild `json:"guilds"`
// Undocumented fields
Settings *Settings `json:"user_settings"`
UserGuildSettings []*UserGuildSettings `json:"user_guild_settings"`
Relationships []*Relationship `json:"relationships"`
Presences []*Presence `json:"presences"`
}
// ChannelCreate is the data for a ChannelCreate event.
type ChannelCreate struct {
*Channel
}
// ChannelUpdate is the data for a ChannelUpdate event.
type ChannelUpdate struct {
*Channel
}
// ChannelDelete is the data for a ChannelDelete event.
type ChannelDelete struct {
*Channel
}
// ChannelPinsUpdate stores data for a ChannelPinsUpdate event.
type ChannelPinsUpdate struct {
LastPinTimestamp string `json:"last_pin_timestamp"`
ChannelID string `json:"channel_id"`
}
// GuildCreate is the data for a GuildCreate event.
type GuildCreate struct {
*Guild
}
// GuildUpdate is the data for a GuildUpdate event.
type GuildUpdate struct {
*Guild
}
// GuildDelete is the data for a GuildDelete event.
type GuildDelete struct {
*Guild
}
// GuildBanAdd is the data for a GuildBanAdd event.
type GuildBanAdd struct {
User *User `json:"user"`
GuildID string `json:"guild_id"`
}
// GuildBanRemove is the data for a GuildBanRemove event.
type GuildBanRemove struct {
User *User `json:"user"`
GuildID string `json:"guild_id"`
}
// GuildMemberAdd is the data for a GuildMemberAdd event.
type GuildMemberAdd struct {
*Member
}
// GuildMemberUpdate is the data for a GuildMemberUpdate event.
type GuildMemberUpdate struct {
*Member
}
// GuildMemberRemove is the data for a GuildMemberRemove event.
type GuildMemberRemove struct {
*Member
}
// GuildRoleCreate is the data for a GuildRoleCreate event.
type GuildRoleCreate struct {
*GuildRole
}
// GuildRoleUpdate is the data for a GuildRoleUpdate event.
type GuildRoleUpdate struct {
*GuildRole
}
// A GuildRoleDelete is the data for a GuildRoleDelete event.
type GuildRoleDelete struct {
RoleID string `json:"role_id"`
GuildID string `json:"guild_id"`
}
// A GuildEmojisUpdate is the data for a guild emoji update event.
type GuildEmojisUpdate struct {
GuildID string `json:"guild_id"`
Emojis []*Emoji `json:"emojis"`
}
// A GuildMembersChunk is the data for a GuildMembersChunk event.
type GuildMembersChunk struct {
GuildID string `json:"guild_id"`
Members []*Member `json:"members"`
}
// GuildIntegrationsUpdate is the data for a GuildIntegrationsUpdate event.
type GuildIntegrationsUpdate struct {
GuildID string `json:"guild_id"`
}
// MessageAck is the data for a MessageAck event.
type MessageAck struct {
MessageID string `json:"message_id"`
ChannelID string `json:"channel_id"`
}
// MessageCreate is the data for a MessageCreate event.
type MessageCreate struct {
*Message
}
// MessageUpdate is the data for a MessageUpdate event.
type MessageUpdate struct {
*Message
}
// MessageDelete is the data for a MessageDelete event.
type MessageDelete struct {
*Message
}
// MessageReactionAdd is the data for a MessageReactionAdd event.
type MessageReactionAdd struct {
*MessageReaction
}
// MessageReactionRemove is the data for a MessageReactionRemove event.
type MessageReactionRemove struct {
*MessageReaction
}
// PresencesReplace is the data for a PresencesReplace event.
type PresencesReplace []*Presence
// PresenceUpdate is the data for a PresenceUpdate event.
type PresenceUpdate struct {
Presence
GuildID string `json:"guild_id"`
Roles []string `json:"roles"`
}
// Resumed is the data for a Resumed event.
type Resumed struct {
HeartbeatInterval time.Duration `json:"heartbeat_interval"`
Trace []string `json:"_trace"`
}
// RelationshipAdd is the data for a RelationshipAdd event.
type RelationshipAdd struct {
*Relationship
}
// RelationshipRemove is the data for a RelationshipRemove event.
type RelationshipRemove struct {
*Relationship
}
// TypingStart is the data for a TypingStart event.
type TypingStart struct {
UserID string `json:"user_id"`
ChannelID string `json:"channel_id"`
Timestamp int `json:"timestamp"`
}
// UserUpdate is the data for a UserUpdate event.
type UserUpdate struct {
*User
}
// UserSettingsUpdate is the data for a UserSettingsUpdate event.
type UserSettingsUpdate map[string]interface{}
// UserGuildSettingsUpdate is the data for a UserGuildSettingsUpdate event.
type UserGuildSettingsUpdate struct {
*UserGuildSettings
}
// VoiceServerUpdate is the data for a VoiceServerUpdate event.
type VoiceServerUpdate struct {
Token string `json:"token"`
GuildID string `json:"guild_id"`
Endpoint string `json:"endpoint"`
}
// VoiceStateUpdate is the data for a VoiceStateUpdate event.
type VoiceStateUpdate struct {
*VoiceState
}