forked from andersfylling/disgord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
events_gen.go
481 lines (340 loc) · 16 KB
/
events_gen.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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
package disgord
// Warning: This file has been automatically generated by generate/events/main.go
// Do NOT make changes here, instead adapt events.go and event/events.go and run go generate
import (
"context"
"github.com/andersfylling/disgord/event"
)
// these "simple" handler can be used, if you don't care about the actual event data
type SimplestHandler = func()
type SimpleHandler = func(session Session)
// ---------------------------
// EventChannelCreate Sent when a new channel is created, relevant to the current user. The inner payload is a DM channel or
// guild channel object.
//
const EventChannelCreate = event.ChannelCreate
func (h *ChannelCreate) registerContext(ctx context.Context) { h.Ctx = ctx }
// ChannelCreateHandler is triggered in ChannelCreate events
type ChannelCreateHandler = func(session Session, h *ChannelCreate)
// ---------------------------
// EventChannelDelete Sent when a channel relevant to the current user is deleted. The inner payload is a DM or Guild channel object.
//
const EventChannelDelete = event.ChannelDelete
func (h *ChannelDelete) registerContext(ctx context.Context) { h.Ctx = ctx }
// ChannelDeleteHandler is triggered in ChannelDelete events
type ChannelDeleteHandler = func(session Session, h *ChannelDelete)
// ---------------------------
// EventChannelPinsUpdate Sent when a message is pinned or unpinned in a text channel. This is not sent when a pinned message is deleted.
// Fields:
// - ChannelID int64 or Snowflake
// - LastPinTimestamp time.Now().UTC().Format(time.RFC3339)
// TODO fix.
//
const EventChannelPinsUpdate = event.ChannelPinsUpdate
func (h *ChannelPinsUpdate) registerContext(ctx context.Context) { h.Ctx = ctx }
// ChannelPinsUpdateHandler is triggered in ChannelPinsUpdate events
type ChannelPinsUpdateHandler = func(session Session, h *ChannelPinsUpdate)
// ---------------------------
// EventChannelUpdate Sent when a channel is updated. The inner payload is a guild channel object.
//
const EventChannelUpdate = event.ChannelUpdate
func (h *ChannelUpdate) registerContext(ctx context.Context) { h.Ctx = ctx }
// ChannelUpdateHandler is triggered in ChannelUpdate events
type ChannelUpdateHandler = func(session Session, h *ChannelUpdate)
// ---------------------------
// EventGuildBanAdd Sent when a user is banned from a guild. The inner payload is a user object, with an extra guild_id key.
//
const EventGuildBanAdd = event.GuildBanAdd
func (h *GuildBanAdd) registerContext(ctx context.Context) { h.Ctx = ctx }
// GuildBanAddHandler is triggered in GuildBanAdd events
type GuildBanAddHandler = func(session Session, h *GuildBanAdd)
// ---------------------------
// EventGuildBanRemove Sent when a user is unbanned from a guild. The inner payload is a user object, with an extra guild_id key.
//
const EventGuildBanRemove = event.GuildBanRemove
func (h *GuildBanRemove) registerContext(ctx context.Context) { h.Ctx = ctx }
// GuildBanRemoveHandler is triggered in GuildBanRemove events
type GuildBanRemoveHandler = func(session Session, h *GuildBanRemove)
// ---------------------------
// EventGuildCreate This event can be sent in three different scenarios:
// 1. When a user is initially connecting, to lazily load and backfill information for all unavailable guilds
// sent in the Ready event.
// 2. When a Guild becomes available again to the client.
// 3. When the current user joins a new Guild.
//
const EventGuildCreate = event.GuildCreate
func (h *GuildCreate) registerContext(ctx context.Context) { h.Ctx = ctx }
// GuildCreateHandler is triggered in GuildCreate events
type GuildCreateHandler = func(session Session, h *GuildCreate)
// ---------------------------
// EventGuildDelete Sent when a guild becomes unavailable during a guild outage, or when the user leaves or is removed from a guild.
// The inner payload is an unavailable guild object. If the unavailable field is not set, the user was removed
// from the guild.
//
const EventGuildDelete = event.GuildDelete
func (h *GuildDelete) registerContext(ctx context.Context) { h.Ctx = ctx }
// GuildDeleteHandler is triggered in GuildDelete events
type GuildDeleteHandler = func(session Session, h *GuildDelete)
// ---------------------------
// EventGuildEmojisUpdate Sent when a guild's emojis have been updated.
// Fields:
// - GuildID Snowflake
// - Emojis []*Emoji
//
const EventGuildEmojisUpdate = event.GuildEmojisUpdate
func (h *GuildEmojisUpdate) registerContext(ctx context.Context) { h.Ctx = ctx }
// GuildEmojisUpdateHandler is triggered in GuildEmojisUpdate events
type GuildEmojisUpdateHandler = func(session Session, h *GuildEmojisUpdate)
// ---------------------------
// EventGuildIntegrationsUpdate Sent when a guild integration is updated.
// Fields:
// - GuildID Snowflake
//
const EventGuildIntegrationsUpdate = event.GuildIntegrationsUpdate
func (h *GuildIntegrationsUpdate) registerContext(ctx context.Context) { h.Ctx = ctx }
// GuildIntegrationsUpdateHandler is triggered in GuildIntegrationsUpdate events
type GuildIntegrationsUpdateHandler = func(session Session, h *GuildIntegrationsUpdate)
// ---------------------------
// EventGuildMemberAdd Sent when a new user joins a guild. The inner payload is a guild member object with these extra fields:
// - GuildID Snowflake
//
// Fields:
// - Member *Member
//
const EventGuildMemberAdd = event.GuildMemberAdd
func (h *GuildMemberAdd) registerContext(ctx context.Context) { h.Ctx = ctx }
// GuildMemberAddHandler is triggered in GuildMemberAdd events
type GuildMemberAddHandler = func(session Session, h *GuildMemberAdd)
// ---------------------------
// EventGuildMemberRemove Sent when a user is removed from a guild (leave/kick/ban).
// Fields:
// - GuildID Snowflake
// - User *User
//
const EventGuildMemberRemove = event.GuildMemberRemove
func (h *GuildMemberRemove) registerContext(ctx context.Context) { h.Ctx = ctx }
// GuildMemberRemoveHandler is triggered in GuildMemberRemove events
type GuildMemberRemoveHandler = func(session Session, h *GuildMemberRemove)
// ---------------------------
// EventGuildMemberUpdate Sent when a guild member is updated.
// Fields:
// - GuildID Snowflake
// - Roles []Snowflake
// - User *User
// - Nick string
//
const EventGuildMemberUpdate = event.GuildMemberUpdate
func (h *GuildMemberUpdate) registerContext(ctx context.Context) { h.Ctx = ctx }
// GuildMemberUpdateHandler is triggered in GuildMemberUpdate events
type GuildMemberUpdateHandler = func(session Session, h *GuildMemberUpdate)
// ---------------------------
// EventGuildMembersChunk Sent in response to Gateway Request Guild Members.
// Fields:
// - GuildID Snowflake
// - Members []*Member
//
const EventGuildMembersChunk = event.GuildMembersChunk
func (h *GuildMembersChunk) registerContext(ctx context.Context) { h.Ctx = ctx }
// GuildMembersChunkHandler is triggered in GuildMembersChunk events
type GuildMembersChunkHandler = func(session Session, h *GuildMembersChunk)
// ---------------------------
// EventGuildRoleCreate Sent when a guild role is created.
// Fields:
// - GuildID Snowflake
// - Role *Role
//
const EventGuildRoleCreate = event.GuildRoleCreate
func (h *GuildRoleCreate) registerContext(ctx context.Context) { h.Ctx = ctx }
// GuildRoleCreateHandler is triggered in GuildRoleCreate events
type GuildRoleCreateHandler = func(session Session, h *GuildRoleCreate)
// ---------------------------
// EventGuildRoleDelete Sent when a guild role is created.
// Fields:
// - GuildID Snowflake
// - RoleID Snowflake
//
const EventGuildRoleDelete = event.GuildRoleDelete
func (h *GuildRoleDelete) registerContext(ctx context.Context) { h.Ctx = ctx }
// GuildRoleDeleteHandler is triggered in GuildRoleDelete events
type GuildRoleDeleteHandler = func(session Session, h *GuildRoleDelete)
// ---------------------------
// EventGuildRoleUpdate Sent when a guild role is created.
// Fields:
// - GuildID Snowflake
// - Role *Role
//
const EventGuildRoleUpdate = event.GuildRoleUpdate
func (h *GuildRoleUpdate) registerContext(ctx context.Context) { h.Ctx = ctx }
// GuildRoleUpdateHandler is triggered in GuildRoleUpdate events
type GuildRoleUpdateHandler = func(session Session, h *GuildRoleUpdate)
// ---------------------------
// EventGuildUpdate Sent when a guild is updated. The inner payload is a guild object.
//
const EventGuildUpdate = event.GuildUpdate
func (h *GuildUpdate) registerContext(ctx context.Context) { h.Ctx = ctx }
// GuildUpdateHandler is triggered in GuildUpdate events
type GuildUpdateHandler = func(session Session, h *GuildUpdate)
// ---------------------------
// EventMessageCreate Sent when a message is created. The inner payload is a message object.
//
const EventMessageCreate = event.MessageCreate
func (h *MessageCreate) registerContext(ctx context.Context) { h.Ctx = ctx }
// MessageCreateHandler is triggered in MessageCreate events
type MessageCreateHandler = func(session Session, h *MessageCreate)
// ---------------------------
// EventMessageDelete Sent when a message is deleted.
// Fields:
// - ID Snowflake
// - ChannelID Snowflake
//
const EventMessageDelete = event.MessageDelete
func (h *MessageDelete) registerContext(ctx context.Context) { h.Ctx = ctx }
// MessageDeleteHandler is triggered in MessageDelete events
type MessageDeleteHandler = func(session Session, h *MessageDelete)
// ---------------------------
// EventMessageDeleteBulk Sent when multiple messages are deleted at once.
// Fields:
// - IDs []Snowflake
// - ChannelID Snowflake
//
const EventMessageDeleteBulk = event.MessageDeleteBulk
func (h *MessageDeleteBulk) registerContext(ctx context.Context) { h.Ctx = ctx }
// MessageDeleteBulkHandler is triggered in MessageDeleteBulk events
type MessageDeleteBulkHandler = func(session Session, h *MessageDeleteBulk)
// ---------------------------
// EventMessageReactionAdd Sent when a user adds a reaction to a message.
// Fields:
// - UserID Snowflake
// - ChannelID Snowflake
// - MessageID Snowflake
// - Emoji *Emoji
//
const EventMessageReactionAdd = event.MessageReactionAdd
func (h *MessageReactionAdd) registerContext(ctx context.Context) { h.Ctx = ctx }
// MessageReactionAddHandler is triggered in MessageReactionAdd events
type MessageReactionAddHandler = func(session Session, h *MessageReactionAdd)
// ---------------------------
// EventMessageReactionRemove Sent when a user removes a reaction from a message.
// Fields:
// - UserID Snowflake
// - ChannelID Snowflake
// - MessageID Snowflake
// - Emoji *Emoji
//
const EventMessageReactionRemove = event.MessageReactionRemove
func (h *MessageReactionRemove) registerContext(ctx context.Context) { h.Ctx = ctx }
// MessageReactionRemoveHandler is triggered in MessageReactionRemove events
type MessageReactionRemoveHandler = func(session Session, h *MessageReactionRemove)
// ---------------------------
// EventMessageReactionRemoveAll Sent when a user explicitly removes all reactions from a message.
// Fields:
// - ChannelID Snowflake
// - MessageID Snowflake
//
const EventMessageReactionRemoveAll = event.MessageReactionRemoveAll
func (h *MessageReactionRemoveAll) registerContext(ctx context.Context) { h.Ctx = ctx }
// MessageReactionRemoveAllHandler is triggered in MessageReactionRemoveAll events
type MessageReactionRemoveAllHandler = func(session Session, h *MessageReactionRemoveAll)
// ---------------------------
// EventMessageUpdate Sent when a message is updated. The inner payload is a message object.
//
// NOTE! Has _at_least_ the GuildID and ChannelID fields.
//
const EventMessageUpdate = event.MessageUpdate
func (h *MessageUpdate) registerContext(ctx context.Context) { h.Ctx = ctx }
// MessageUpdateHandler is triggered in MessageUpdate events
type MessageUpdateHandler = func(session Session, h *MessageUpdate)
// ---------------------------
// EventPresenceUpdate A user's presence is their current state on a guild. This event is sent when a user's presence is updated for a guild.
// Fields:
// - User *User
// - Roles []Snowflake
// - Game *Activity
// - GuildID Snowflake
// - Status string
//
const EventPresenceUpdate = event.PresenceUpdate
func (h *PresenceUpdate) registerContext(ctx context.Context) { h.Ctx = ctx }
// PresenceUpdateHandler is triggered in PresenceUpdate events
type PresenceUpdateHandler = func(session Session, h *PresenceUpdate)
// ---------------------------
// EventPresencesReplace Holds and array of presence update objects
//
const EventPresencesReplace = event.PresencesReplace
func (h *PresencesReplace) registerContext(ctx context.Context) { h.Ctx = ctx }
// PresencesReplaceHandler is triggered in PresencesReplace events
type PresencesReplaceHandler = func(session Session, h *PresencesReplace)
// ---------------------------
// EventReady The ready event is dispatched when a client has completed the initial handshake with the gateway (for new sessions).
// // The ready event can be the largest and most complex event the gateway will send, as it contains all the state
// // required for a client to begin interacting with the rest of the platform.
// // Fields:
// // - V int
// // - User *User
// // - PrivateChannels []*Channel
// // - Guilds []*GuildUnavailable
// // - SessionID string
// // - Trace []string
//
const EventReady = event.Ready
func (h *Ready) registerContext(ctx context.Context) { h.Ctx = ctx }
// ReadyHandler is triggered in Ready events
type ReadyHandler = func(session Session, h *Ready)
// ---------------------------
// EventResumed The resumed event is dispatched when a client has sent a resume payload to the gateway
// (for resuming existing sessions).
// Fields:
// - Trace []string
//
const EventResumed = event.Resumed
func (h *Resumed) registerContext(ctx context.Context) { h.Ctx = ctx }
// ResumedHandler is triggered in Resumed events
type ResumedHandler = func(session Session, h *Resumed)
// ---------------------------
// EventTypingStart Sent when a user starts typing in a channel.
// Fields:
// - ChannelID Snowflake
// - UserID Snowflake
// - TimestampUnix int
//
const EventTypingStart = event.TypingStart
func (h *TypingStart) registerContext(ctx context.Context) { h.Ctx = ctx }
// TypingStartHandler is triggered in TypingStart events
type TypingStartHandler = func(session Session, h *TypingStart)
// ---------------------------
// EventUserUpdate Sent when properties about the user change. Inner payload is a user object.
//
const EventUserUpdate = event.UserUpdate
func (h *UserUpdate) registerContext(ctx context.Context) { h.Ctx = ctx }
// UserUpdateHandler is triggered in UserUpdate events
type UserUpdateHandler = func(session Session, h *UserUpdate)
// ---------------------------
// EventVoiceServerUpdate Sent when a guild's voice server is updated. This is sent when initially connecting to voice, and when the current
// voice instance fails over to a new server.
// Fields:
// - Token string
// - ChannelID Snowflake
// - Endpoint string
//
const EventVoiceServerUpdate = event.VoiceServerUpdate
func (h *VoiceServerUpdate) registerContext(ctx context.Context) { h.Ctx = ctx }
// VoiceServerUpdateHandler is triggered in VoiceServerUpdate events
type VoiceServerUpdateHandler = func(session Session, h *VoiceServerUpdate)
// ---------------------------
// EventVoiceStateUpdate Sent when someone joins/leaves/moves voice channels. Inner payload is a voice state object.
//
const EventVoiceStateUpdate = event.VoiceStateUpdate
func (h *VoiceStateUpdate) registerContext(ctx context.Context) { h.Ctx = ctx }
// VoiceStateUpdateHandler is triggered in VoiceStateUpdate events
type VoiceStateUpdateHandler = func(session Session, h *VoiceStateUpdate)
// ---------------------------
// EventWebhooksUpdate Sent when a guild channel's webhook is created, updated, or deleted.
// Fields:
// - GuildID Snowflake
// - ChannelID Snowflake
//
const EventWebhooksUpdate = event.WebhooksUpdate
func (h *WebhooksUpdate) registerContext(ctx context.Context) { h.Ctx = ctx }
// WebhooksUpdateHandler is triggered in WebhooksUpdate events
type WebhooksUpdateHandler = func(session Session, h *WebhooksUpdate)
// ---------------------------