-
Notifications
You must be signed in to change notification settings - Fork 0
/
file.events.html
587 lines (321 loc) · 43.8 KB
/
file.events.html
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
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="/favicon.png" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
File: Events
— discorb v0.20.0 documentation
</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<link rel="stylesheet" href="css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "events";
relpath = '';
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="file_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="a_index.html">Index</a> »
<span class="title">File: Events</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><div id='filecontents'>
<h1 id="label-Events">Events</h1>
<h2 id="label-How+to+use+events">How to use events</h2>
<p>discorb uses event driven programming. You can register event handlers with <span class='object_link'><a href="Discorb/Client.html#on-instance_method" title="Discorb::Client#on (method)">Discorb::Client#on</a></span>. Alternatively, you can use <span class='object_link'><a href="Discorb/Client.html#once-instance_method" title="Discorb::Client#once (method)">Discorb::Client#once</a></span> to register a one-time event handler.</p>
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span> <span class='symbol'>:message</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_event'>event</span><span class='op'>|</span>
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_event'>event</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_content'>content</span>
<span class='kw'>end</span>
</code></pre>
<p>This example will print the content of every message received.</p>
<p>Since v0.2.5, you can also register event handlers by adding a method to the client, with the prefix <code>on_</code> and the event name as the method name.</p>
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_client'>client</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Discorb.html" title="Discorb (module)">Discorb</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Discorb/Client.html" title="Discorb::Client (class)">Client</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Discorb/Client.html#initialize-instance_method" title="Discorb::Client#initialize (method)">new</a></span></span>
<span class='kw'>class</span> <span class='op'><<</span> <span class='id identifier rubyid_client'>client</span>
<span class='kw'>def</span> <span class='id identifier rubyid_on_standby'>on_standby</span>
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Ready!</span><span class='tstring_end'>"</span></span>
<span class='kw'>end</span>
<span class='kw'>end</span>
</code></pre>
<p>If you want to separate event handlers from the client, consider using <span class='object_link'><a href="Discorb/Extension.html" title="Discorb::Extension (module)">Discorb::Extension</a></span>. <a href="file.extension.html" title="Learn more about extensions">Learn more about extensions</a>.</p>
<p>Since v0.6.1, you can set <code>:override</code> to <code>true</code> to register event handlers that can be overridden.</p>
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span> <span class='symbol'>:message</span><span class='comma'>,</span> <span class='label'>override:</span> <span class='kw'>true</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_event'>event</span><span class='op'>|</span>
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>This event handler can be overridden.</span><span class='tstring_end'>"</span></span>
<span class='kw'>end</span>
<span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span> <span class='symbol'>:message</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_event'>event</span><span class='op'>|</span>
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Override!</span><span class='tstring_end'>"</span></span>
<span class='kw'>end</span>
</code></pre>
<p>This example will print <code>Override!</code>, but not <code>This event handler can be overridden.</code>. This is useful for registering event handlers as default behavior, such as error handlers.</p>
<pre class="code ruby"><code class="ruby"><span class='comment'># In the library...
</span>
<span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span> <span class='symbol'>:command_error</span><span class='comma'>,</span> <span class='label'>override:</span> <span class='kw'>true</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_event'>event</span><span class='comma'>,</span> <span class='id identifier rubyid_error'>error</span><span class='op'>|</span>
<span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Command error:\n</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_full_message'>full_message</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
<span class='kw'>end</span>
<span class='comment'># In your code...
</span>
<span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span> <span class='symbol'>:command_error</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_event'>event</span><span class='comma'>,</span> <span class='id identifier rubyid_error'>error</span><span class='op'>|</span>
<span class='id identifier rubyid_event'>event</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_reply'>reply</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>An error occurred while executing the command!\n</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_full_message'>full_message</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
<span class='kw'>end</span>
</code></pre>
<h2 id="label-Event+reference">Event reference</h2>
<h3 id="label-Client+events">Client events</h3>
<h4 id="label-event_receive-28event_name-2C+data-29"><code>event_receive(event_name, data)</code></h4>
<p>Fires when an event is received.</p>
<p>| Parameter | Type | Description | | ———— | ——– | ———————- | | <code>event_name</code> | <code>Symbol</code> | The name of the event. | | <code>data</code> | <code>Hash</code> | The data of the event. |</p>
<h4 id="label-ready-28-29"><code>ready()</code></h4>
<p>Fires when the client receives the <code>READY</code> event.</p>
<h4 id="label-standby-28-29"><code>standby()</code></h4>
<p>Fires when the client is standby. (When the client connects to Discord, and has cached guilds and members.)</p>
<h4 id="label-resumed-28-29"><code>resumed()</code></h4>
<p>Fires when the client is resumed connection.</p>
<h4 id="label-error-28event_name-2C+args-2C+error-29"><code>error(event_name, args, error)</code></h4>
<p>Fires when an error occurs during an event. Defaults to printing the error to stderr, override to handle it yourself.</p>
<p>| Parameter | Type | Description | | ———— | ————— | ————————— | | <code>event_name</code> | <code>Symbol</code> | The name of the event. | | <code>args</code> | <code>Array<Object></code> | The arguments of the event. | | <code>error</code> | <code>Exception</code> | The error that occurred. |</p>
<h4 id="label-setup-28-29"><code>setup()</code></h4>
<p>Fires when <code>discorb setup</code> is run. This is useful for setting up some dependencies, such as the database.</p>
<h4 id="label-shard_standby-28shard-29"><code>shard_standby(shard)</code></h4>
<p>Fires when a shard is standby.</p>
<p>| Parameter | Type | Description | | ——— | —————- | ————————– | | <code>shard</code> | <span class='object_link'><a href="Discorb/Shard.html" title="Discorb::Shard (class)">Discorb::Shard</a></span> | The shard that is standby. |</p>
<h4 id="label-shard_resumed-28shard-29"><code>shard_resumed(shard)</code></h4>
<p>Fires when a shard is resumed connection.</p>
<p>| Parameter | Type | Description | | ——— | —————- | ————————– | | <code>shard</code> | <span class='object_link'><a href="Discorb/Shard.html" title="Discorb::Shard (class)">Discorb::Shard</a></span> | The shard that is standby. |</p>
<h3 id="label-Guild+events">Guild events</h3>
<h4 id="label-guild_join-28guild-29"><code>guild_join(guild)</code></h4>
<p>Fires when client joins a guild.</p>
<p>| Parameter | Type | Description | | ——— | —————- | ————————– | | <code>guild</code> | <span class='object_link'><a href="Discorb/Guild.html" title="Discorb::Guild (class)">Discorb::Guild</a></span> | The guild that was joined. |</p>
<h4 id="label-guild_available-28guild-29"><code>guild_available(guild)</code></h4>
<p>Fires when a guild becomes available.</p>
<p>| Parameter | Type | Description | | ——— | —————- | ——————————– | | <code>guild</code> | <span class='object_link'><a href="Discorb/Guild.html" title="Discorb::Guild (class)">Discorb::Guild</a></span> | The guild that became available. |</p>
<h4 id="label-guild_update-28before-2C+after-29"><code>guild_update(before, after)</code></h4>
<p>Fires when client updates a guild.</p>
<p>| Parameter | Type | Description | | ——— | —————- | —————————- | | <code>before</code> | <span class='object_link'><a href="Discorb/Guild.html" title="Discorb::Guild (class)">Discorb::Guild</a></span> | The guild before the update. | | <code>after</code> | <span class='object_link'><a href="Discorb/Guild.html" title="Discorb::Guild (class)">Discorb::Guild</a></span> | The guild after the update. |</p>
<h4 id="label-guild_leave-28guild-29"><code>guild_leave(guild)</code></h4>
<p>Fires when client leaves a guild.</p>
<p>| Parameter | Type | Description | | ——— | —————- | ———————— | | <code>guild</code> | <span class='object_link'><a href="Discorb/Guild.html" title="Discorb::Guild (class)">Discorb::Guild</a></span> | The guild that was left. |</p>
<h4 id="label-guild_destroy-28guild-29"><code>guild_destroy(guild)</code></h4>
<p>Fires when guild is destroyed.</p>
<p>| Parameter | Type | Description | | ——— | —————- | —————————– | | <code>guild</code> | <span class='object_link'><a href="Discorb/Guild.html" title="Discorb::Guild (class)">Discorb::Guild</a></span> | The guild that was destroyed. |</p>
<h4 id="label-guild_integrations_update-28guild-29"><code>guild_integrations_update(guild)</code></h4>
<p>Fires when guild integrations are updated.</p>
<p>| Parameter | Type | Description | | ——— | —————- | ——————————————— | | <code>guild</code> | <span class='object_link'><a href="Discorb/Guild.html" title="Discorb::Guild (class)">Discorb::Guild</a></span> | The guild that integrations were updated for. |</p>
<h4 id="label-guild_ban_add-28guild-2C+user-29"><code>guild_ban_add(guild, user)</code></h4>
<p>Fires when a user is banned from a guild.</p>
<p>| Parameter | Type | Description | | ——— | —————- | —————————————- | | <code>guild</code> | <span class='object_link'><a href="Discorb/Guild.html" title="Discorb::Guild (class)">Discorb::Guild</a></span> | The guild that the user was banned from. | | <code>user</code> | <span class='object_link'><a href="Discorb/User.html" title="Discorb::User (class)">Discorb::User</a></span> | The user that was banned. |</p>
<h4 id="label-guild_ban_remove-28guild-2C+user-29"><code>guild_ban_remove(guild, user)</code></h4>
<p>Fires when a user is unbanned from a guild.</p>
<p>| Parameter | Type | Description | | ——— | —————- | —————————————— | | <code>guild</code> | <span class='object_link'><a href="Discorb/Guild.html" title="Discorb::Guild (class)">Discorb::Guild</a></span> | The guild that the user was unbanned from. | | <code>user</code> | <span class='object_link'><a href="Discorb/User.html" title="Discorb::User (class)">Discorb::User</a></span> | The user that was unbanned. |</p>
<h3 id="label-Channel+events">Channel events</h3>
<h4 id="label-channel_create-28channel-29"><code>channel_create(channel)</code></h4>
<p>Fires when a channel is created.</p>
<p>| Parameter | Type | Description | | ——— | —————— | —————————– | | <code>channel</code> | <span class='object_link'><a href="Discorb/Channel.html" title="Discorb::Channel (class)">Discorb::Channel</a></span> | The channel that was created. |</p>
<h4 id="label-channel_update-28before-2C+after-29"><code>channel_update(before, after)</code></h4>
<p>Fires when a channel is updated.</p>
<p>| Parameter | Type | Description | | ——— | —————— | —————————— | | <code>before</code> | <span class='object_link'><a href="Discorb/Channel.html" title="Discorb::Channel (class)">Discorb::Channel</a></span> | The channel before the update. | | <code>after</code> | <span class='object_link'><a href="Discorb/Channel.html" title="Discorb::Channel (class)">Discorb::Channel</a></span> | The channel after the update. |</p>
<h4 id="label-channel_delete-28channel-29"><code>channel_delete(channel)</code></h4>
<p>Fires when a channel is deleted.</p>
<p>| Parameter | Type | Description | | ——— | —————— | —————————– | | <code>channel</code> | <span class='object_link'><a href="Discorb/Channel.html" title="Discorb::Channel (class)">Discorb::Channel</a></span> | The channel that was deleted. |</p>
<h4 id="label-webhooks_update-28event-29"><code>webhooks_update(event)</code></h4>
<p>Fires when a webhook is updated.</p>
<p>| Parameter | Type | Description | | ——— | ————————————— | ————————- | | <code>event</code> | <span class='object_link'><a href="Discorb/Gateway/WebhooksUpdateEvent.html" title="Discorb::Gateway::WebhooksUpdateEvent (class)">Discorb::Gateway::WebhooksUpdateEvent</a></span> | The webhook update event. |</p>
<h4 id="label-thread_new-28thread-29"><code>thread_new(thread)</code></h4>
<p>Fires when a thread is created.</p>
<p>| Parameter | Type | Description | | ——— | ———————— | —————————- | | <code>thread</code> | <span class='object_link'><a href="Discorb/ThreadChannel.html" title="Discorb::ThreadChannel (class)">Discorb::ThreadChannel</a></span> | The thread that was created. |</p>
<h4 id="label-thread_join-28thread-29"><code>thread_join(thread)</code></h4>
<p>Fires when client joins a thread.</p>
<p>| Parameter | Type | Description | | ——— | ———————— | ————————— | | <code>thread</code> | <span class='object_link'><a href="Discorb/ThreadChannel.html" title="Discorb::ThreadChannel (class)">Discorb::ThreadChannel</a></span> | The thread that was joined. |</p>
<h4 id="label-thread_delete-28thread-29"><code>thread_delete(thread)</code></h4>
<p>Fires when a thread is deleted.</p>
<p>| Parameter | Type | Description | | ——— | ———————— | —————————- | | <code>thread</code> | <span class='object_link'><a href="Discorb/ThreadChannel.html" title="Discorb::ThreadChannel (class)">Discorb::ThreadChannel</a></span> | The thread that was deleted. |</p>
<h4 id="label-thread_update-28before-2C+after-29"><code>thread_update(before, after)</code></h4>
<p>Fires when a thread is updated.</p>
<p>| Parameter | Type | Description | | ——— | ———————— | —————————– | | <code>before</code> | <span class='object_link'><a href="Discorb/ThreadChannel.html" title="Discorb::ThreadChannel (class)">Discorb::ThreadChannel</a></span> | The thread before the update. | | <code>after</code> | <span class='object_link'><a href="Discorb/ThreadChannel.html" title="Discorb::ThreadChannel (class)">Discorb::ThreadChannel</a></span> | The thread after the update. |</p>
<h4 id="label-thread_members_update-28thread-2C+added-2C+removed-29"><code>thread_members_update(thread, added, removed)</code></h4>
<p>Fires when a thread's members are updated.</p>
<p>| Parameter | Type | Description | | ——— | ————————————— | ————————————————————————————— | | <code>thread</code> | <span class='object_link'><a href="Discorb/ThreadChannel.html" title="Discorb::ThreadChannel (class)">Discorb::ThreadChannel</a></span> | The thread that the members were updated for. | | <code>added</code> | Array<<span class='object_link'><a href="Discorb/ThreadChannel/Member.html" title="Discorb::ThreadChannel::Member (class)">Discorb::ThreadChannel::Member</a></span>> | An array of <span class='object_link'><a href="Discorb/ThreadChannel/Member.html" title="Discorb::ThreadChannel::Member (class)">Discorb::ThreadChannel::Member</a></span> objects that were added to the thread. | | <code>removed</code> | Array<<span class='object_link'><a href="Discorb/ThreadChannel/Member.html" title="Discorb::ThreadChannel::Member (class)">Discorb::ThreadChannel::Member</a></span>> | An array of <span class='object_link'><a href="Discorb/ThreadChannel/Member.html" title="Discorb::ThreadChannel::Member (class)">Discorb::ThreadChannel::Member</a></span> objects that were removed from the thread. |</p>
<h4 id="label-thread_member_update-28before-2C+after-29"><code>thread_member_update(before, after)</code></h4>
<p>Fires when a thread member is updated.</p>
<p>| Parameter | Type | Description | | ——— | ——————————– | ——————————————- | | <code>thread</code> | <span class='object_link'><a href="Discorb/ThreadChannel.html" title="Discorb::ThreadChannel (class)">Discorb::ThreadChannel</a></span> | The thread that the member was updated for. | | <code>before</code> | <span class='object_link'><a href="Discorb/ThreadChannel/Member.html" title="Discorb::ThreadChannel::Member (class)">Discorb::ThreadChannel::Member</a></span> | The thread member before the update. | | <code>after</code> | <span class='object_link'><a href="Discorb/ThreadChannel/Member.html" title="Discorb::ThreadChannel::Member (class)">Discorb::ThreadChannel::Member</a></span> | The thread member after the update. |</p>
<h3 id="label-Integration+events">Integration events</h3>
<h4 id="label-integration_create-28integration-29"><code>integration_create(integration)</code></h4>
<p>Fires when a guild integration is created.</p>
<p>| Parameter | Type | Description | | ————- | ———————- | ———————— | | <code>integration</code> | <span class='object_link'><a href="Discorb/Integration.html" title="Discorb::Integration (class)">Discorb::Integration</a></span> | The created integration. |</p>
<h4 id="label-integration_update-28after-29"><code>integration_update(after)</code></h4>
<p>Fires when a guild integration is updated.</p>
<p>| Parameter | Type | Description | | ——— | ———————- | ——————————— | | <code>after</code> | <span class='object_link'><a href="Discorb/Integration.html" title="Discorb::Integration (class)">Discorb::Integration</a></span> | The integration after the update. |</p>
<h4 id="label-integration_delete-28integration-29"><code>integration_delete(integration)</code></h4>
<p>Fires when a guild integration is deleted.</p>
<p>| Parameter | Type | Description | | ————- | ———————- | ———————— | | <code>integration</code> | <span class='object_link'><a href="Discorb/Integration.html" title="Discorb::Integration (class)">Discorb::Integration</a></span> | The deleted integration. |</p>
<h3 id="label-Message+events">Message events</h3>
<h4 id="label-message-28message-29"><code>message(message)</code></h4>
<p>Fires when a message is created.</p>
<p>| Parameter | Type | Description | | ——— | —————— | ——————– | | <code>message</code> | <span class='object_link'><a href="Discorb/Message.html" title="Discorb::Message (class)">Discorb::Message</a></span> | The created message. |</p>
<h4 id="label-message_update-28event-29"><code>message_update(event)</code></h4>
<p>Fires when a message is updated.</p>
<p>| Parameter | Type | Description | | ——— | ————————————– | —————————– | | <code>event</code> | <span class='object_link'><a href="Discorb/Gateway/MessageUpdateEvent.html" title="Discorb::Gateway::MessageUpdateEvent (class)">Discorb::Gateway::MessageUpdateEvent</a></span> | The message after the update. |</p>
<h4 id="label-message_delete-28message-2C+channel-2C+guild-29"><code>message_delete(message, channel, guild)</code></h4>
<p>Fires when a message is deleted.</p>
<p>| Parameter | Type | Description | | ——— | —————— | —————————————– | | <code>message</code> | <span class='object_link'><a href="Discorb/Message.html" title="Discorb::Message (class)">Discorb::Message</a></span> | The deleted message. | | <code>channel</code> | <span class='object_link'><a href="Discorb/Channel.html" title="Discorb::Channel (class)">Discorb::Channel</a></span> | The channel the message was deleted from. | | <code>guild</code> | ?<span class='object_link'><a href="Discorb/Guild.html" title="Discorb::Guild (class)">Discorb::Guild</a></span> | The guild the message was deleted from. |</p>
<h5 id="label-Note">Note</h5>
<p>This will fire when cached messages are deleted.</p>
<h4 id="label-message_delete_id-28message_id-2C+channel-2C+guild-29"><code>message_delete_id(message_id, channel, guild)</code></h4>
<p>Fires when a message is deleted. Not like <a href="file._23message_delete.html" title="#message_delete">#message_delete</a> this will fire even message is not cached.</p>
<p>| Parameter | Type | Description | | ———— | ——————– | —————————————– | | <code>message_id</code> | <span class='object_link'><a href="Discorb/Snowflake.html" title="Discorb::Snowflake (class)">Discorb::Snowflake</a></span> | The deleted message ID. | | <code>channel</code> | <span class='object_link'><a href="Discorb/Channel.html" title="Discorb::Channel (class)">Discorb::Channel</a></span> | The channel the message was deleted from. | | <code>guild</code> | ?<span class='object_link'><a href="Discorb/Guild.html" title="Discorb::Guild (class)">Discorb::Guild</a></span> | The guild the message was deleted from. |</p>
<h4 id="label-message_delete_bulk-28messages-29"><code>message_delete_bulk(messages)</code></h4>
<p>Fires when a bulk of messages are deleted.</p>
<p>| Parameter | Type | Description | | ———- | ———————————————————————– | ——————— | | <code>messages</code> | Array<<span class='object_link'><a href="Discorb/Message.html" title="Discorb::Message (class)">Discorb::Message</a></span>, <span class='object_link'><a href="Discorb/Gateway/UnknownDeleteBulkMessage.html" title="Discorb::Gateway::UnknownDeleteBulkMessage (class)">Discorb::Gateway::UnknownDeleteBulkMessage</a></span>> | The deleted messages. |</p>
<h4 id="label-message_pin_update-28event-29"><code>message_pin_update(event)</code></h4>
<p>Fires when a message is pinned or unpinned.</p>
<p>| Parameter | Type | Description | | ——— | ———————————– | —————– | | <code>event</code> | <span class='object_link'><a href="Discorb/Gateway/MessagePinEvent.html" title="Discorb::Gateway::MessagePinEvent (class)">Discorb::Gateway::MessagePinEvent</a></span> | The event object. |</p>
<h4 id="label-typing_start-28event-29"><code>typing_start(event)</code></h4>
<p>Fires when a user starts typing.</p>
<p>| Parameter | Type | Description | | ——— | ———————————— | —————– | | <code>event</code> | <span class='object_link'><a href="Discorb/Gateway/TypingStartEvent.html" title="Discorb::Gateway::TypingStartEvent (class)">Discorb::Gateway::TypingStartEvent</a></span> | The event object. |</p>
<h3 id="label-Reaction+events">Reaction events</h3>
<h4 id="label-reaction_add-28event-29"><code>reaction_add(event)</code></h4>
<p>Fires when a reaction is added to a message.</p>
<p>| Parameter | Type | Description | | ——— | ——————————— | —————– | | <code>event</code> | <span class='object_link'><a href="Discorb/Gateway/ReactionEvent.html" title="Discorb::Gateway::ReactionEvent (class)">Discorb::Gateway::ReactionEvent</a></span> | The event object. |</p>
<h4 id="label-reaction_remove-28event-29"><code>reaction_remove(event)</code></h4>
<p>Fires when someone removes a reaction from a message.</p>
<p>| Parameter | Type | Description | | ——— | ——————————— | —————– | | <code>event</code> | <span class='object_link'><a href="Discorb/Gateway/ReactionEvent.html" title="Discorb::Gateway::ReactionEvent (class)">Discorb::Gateway::ReactionEvent</a></span> | The event object. |</p>
<h4 id="label-reaction_remove_all-28event-29"><code>reaction_remove_all(event)</code></h4>
<p>Fires when all reactions are removed from a message.</p>
<p>| Parameter | Type | Description | | ——— | —————————————— | —————– | | <code>event</code> | <span class='object_link'><a href="Discorb/Gateway/ReactionRemoveAllEvent.html" title="Discorb::Gateway::ReactionRemoveAllEvent (class)">Discorb::Gateway::ReactionRemoveAllEvent</a></span> | The event object. |</p>
<h4 id="label-reaction_remove_emoji-28event-29"><code>reaction_remove_emoji(event)</code></h4>
<p>Fires when a reaction is removed from a message.</p>
<p>| Parameter | Type | Description | | ——— | ——————————————– | —————– | | <code>event</code> | <span class='object_link'><a href="Discorb/Gateway/ReactionRemoveEmojiEvent.html" title="Discorb::Gateway::ReactionRemoveEmojiEvent (class)">Discorb::Gateway::ReactionRemoveEmojiEvent</a></span> | The event object. |</p>
<h3 id="label-Role+events">Role events</h3>
<h4 id="label-role_create-28role-29"><code>role_create(role)</code></h4>
<p>Fires when a role is created.</p>
<p>| Parameter | Type | Description | | ——— | ————— | —————– | | <code>role</code> | <span class='object_link'><a href="Discorb/Role.html" title="Discorb::Role (class)">Discorb::Role</a></span> | The created role. |</p>
<h4 id="label-role_update-28before-2C+after-29"><code>role_update(before, after)</code></h4>
<p>Fires when a role is updated.</p>
<p>| Parameter | Type | Description | | ——— | ————— | ————————— | | <code>before</code> | <span class='object_link'><a href="Discorb/Role.html" title="Discorb::Role (class)">Discorb::Role</a></span> | The role before the update. | | <code>after</code> | <span class='object_link'><a href="Discorb/Role.html" title="Discorb::Role (class)">Discorb::Role</a></span> | The role after the update. |</p>
<h4 id="label-role_remove-28role-29"><code>role_remove(role)</code></h4>
<p>Fires when a role is deleted.</p>
<p>| Parameter | Type | Description | | ——— | ————— | —————– | | <code>role</code> | <span class='object_link'><a href="Discorb/Role.html" title="Discorb::Role (class)">Discorb::Role</a></span> | The deleted role. |</p>
<h3 id="label-Member+events">Member events</h3>
<h4 id="label-Note">Note</h4>
<p>These events require the <code>guild_members</code> intent.</p>
<h4 id="label-member_add-28member-29"><code>member_add(member)</code></h4>
<p>Fires when a member joins a guild.</p>
<p>| Parameter | Type | Description | | ——— | —————– | ———————– | | <code>member</code> | <span class='object_link'><a href="Discorb/Member.html" title="Discorb::Member (class)">Discorb::Member</a></span> | The member that joined. |</p>
<h4 id="label-member_update-28before-2C+after-29"><code>member_update(before, after)</code></h4>
<p>Fires when a member is updated.</p>
<p>| Parameter | Type | Description | | ——— | —————– | —————————– | | <code>before</code> | <span class='object_link'><a href="Discorb/Member.html" title="Discorb::Member (class)">Discorb::Member</a></span> | The member before the update. | | <code>after</code> | <span class='object_link'><a href="Discorb/Member.html" title="Discorb::Member (class)">Discorb::Member</a></span> | The member after the update. |</p>
<h4 id="label-member_remove-28member-29"><code>member_remove(member)</code></h4>
<p>Fires when a member is removed from a guild.</p>
<p>| Parameter | Type | Description | | ——— | —————– | ——————— | | <code>member</code> | <span class='object_link'><a href="Discorb/Member.html" title="Discorb::Member (class)">Discorb::Member</a></span> | The member that left. |</p>
<h3 id="label-Role+events">Role events</h3>
<h4 id="label-role_create-28role-29"><code>role_create(role)</code></h4>
<p>Fires when a role is created.</p>
<p>| Parameter | Type | Description | | ——— | ————— | —————– | | <code>role</code> | <span class='object_link'><a href="Discorb/Role.html" title="Discorb::Role (class)">Discorb::Role</a></span> | The created role. |</p>
<h4 id="label-role_update-28before-2C+after-29"><code>role_update(before, after)</code></h4>
<p>Fires when a role is updated.</p>
<p>| Parameter | Type | Description | | ——— | ————— | ————————— | | <code>before</code> | <span class='object_link'><a href="Discorb/Role.html" title="Discorb::Role (class)">Discorb::Role</a></span> | The role before the update. | | <code>after</code> | <span class='object_link'><a href="Discorb/Role.html" title="Discorb::Role (class)">Discorb::Role</a></span> | The role after the update. |</p>
<h4 id="label-role_remove-28role-29"><code>role_remove(role)</code></h4>
<p>Fires when a role is deleted.</p>
<p>| Parameter | Type | Description | | ——— | ————— | —————– | | <code>role</code> | <span class='object_link'><a href="Discorb/Role.html" title="Discorb::Role (class)">Discorb::Role</a></span> | The deleted role. |</p>
<h3 id="label-Invite+events">Invite events</h3>
<h4 id="label-invite_create-28invite-29"><code>invite_create(invite)</code></h4>
<p>Fires when an invitation is created.</p>
<p>| Parameter | Type | Description | | ——— | —————– | ——————- | | <code>invite</code> | <span class='object_link'><a href="Discorb/Invite.html" title="Discorb::Invite (class)">Discorb::Invite</a></span> | The created invite. |</p>
<h4 id="label-invite_delete-28invite-29"><code>invite_delete(invite)</code></h4>
<p>Fires when an invitation is deleted.</p>
<p>| Parameter | Type | Description | | ——— | —————– | ——————- | | <code>invite</code> | <span class='object_link'><a href="Discorb/Invite.html" title="Discorb::Invite (class)">Discorb::Invite</a></span> | The deleted invite. |</p>
<h3 id="label-Interaction+events">Interaction events</h3>
<h4 id="label-interaction_create-28interaction-29"><code>interaction_create(interaction)</code></h4>
<p>Fires when an interaction is created. This will fire for all interactions.</p>
<p>| Parameter | Type | Description | | ————- | ———————- | ———————— | | <code>interaction</code> | <span class='object_link'><a href="Discorb/Interaction.html" title="Discorb::Interaction (class)">Discorb::Interaction</a></span> | The created interaction. |</p>
<h4 id="label-application_command-28interaction-29"><code>application_command(interaction)</code></h4>
<p>Fires when an application command is used.</p>
<p>| Parameter | Type | Description | | ————- | —————————– | ———————— | | <code>interaction</code> | <span class='object_link'><a href="Discorb/CommandInteraction.html" title="Discorb::CommandInteraction (class)">Discorb::CommandInteraction</a></span> | The created interaction. |</p>
<h4 id="label-slash_command-28interaction-29"><code>slash_command(interaction)</code></h4>
<p>Fires when a slash command is used.</p>
<p>| Parameter | Type | Description | | ————- | ———————————————– | ———————— | | <code>interaction</code> | <span class='object_link'><a href="Discorb/CommandInteraction/ChatInputCommand.html" title="Discorb::CommandInteraction::ChatInputCommand (class)">Discorb::CommandInteraction::ChatInputCommand</a></span> | The created interaction. |</p>
<h4 id="label-message_command-28interaction-29"><code>message_command(interaction)</code></h4>
<p>Fires when a message command is used.</p>
<p>| Parameter | Type | Description | | ————- | ————————————————- | ———————— | | <code>interaction</code> | <span class='object_link'><a href="Discorb/CommandInteraction/MessageMenuCommand.html" title="Discorb::CommandInteraction::MessageMenuCommand (class)">Discorb::CommandInteraction::MessageMenuCommand</a></span> | The created interaction. |</p>
<h4 id="label-user_command-28interaction-29"><code>user_command(interaction)</code></h4>
<p>Fires when a user command is used.</p>
<p>| Parameter | Type | Description | | ————- | ———————————————- | ———————— | | <code>interaction</code> | <span class='object_link'><a href="Discorb/CommandInteraction/UserMenuCommand.html" title="Discorb::CommandInteraction::UserMenuCommand (class)">Discorb::CommandInteraction::UserMenuCommand</a></span> | The created interaction. |</p>
<h4 id="label-button_click-28interaction-29"><code>button_click(interaction)</code></h4>
<p>Fires when a button is clicked.</p>
<p>| Parameter | Type | Description | | ————- | ———————————————- | ———————– | | <code>interaction</code> | <span class='object_link'><a href="Discorb/MessageComponentInteraction/Button.html" title="Discorb::MessageComponentInteraction::Button (class)">Discorb::MessageComponentInteraction::Button</a></span> | The interaction object. |</p>
<h4 id="label-select_menu_select-28interaction-29"><code>select_menu_select(interaction)</code></h4>
<p>Fires when a select menu is selected.</p>
<p>| Parameter | Type | Description | | ————- | ————————————————– | ———————– | | <code>interaction</code> | <span class='object_link'><a href="Discorb/MessageComponentInteraction/SelectMenu.html" title="Discorb::MessageComponentInteraction::SelectMenu (class)">Discorb::MessageComponentInteraction::SelectMenu</a></span> | The interaction object. |</p>
<h4 id="label-modal_submit-28interaction-29"><code>modal_submit(interaction)</code></h4>
<p>Fires when a modal is submitted.</p>
<p>| Parameter | Type | Description | | ————- | ————————— | ———————– | | <code>interaction</code> | <span class='object_link'><a href="Discorb/ModalInteraction.html" title="Discorb::ModalInteraction (class)">Discorb::ModalInteraction</a></span> | The interaction object. |</p>
<h3 id="label-Voice+events">Voice events</h3>
<p>Because it's big, it's documented in <a href="file.voice_events.html" title="Voice Events">Voice Events</a>.</p>
<h3 id="label-Guild+scheduled+event+events">Guild scheduled event events</h3>
<h4 id="label-scheduled_event_create-28event-29"><code>scheduled_event_create(event)</code></h4>
<p>Fires when a scheduled event is created.</p>
<p>| Parameter | Type | Description | | ——— | ————————- | —————————- | | <code>event</code> | <span class='object_link'><a href="Discorb/ScheduledEvent.html" title="Discorb::ScheduledEvent (class)">Discorb::ScheduledEvent</a></span> | The created scheduled event. |</p>
<h4 id="label-scheduled_event_cancel-28event-29-2C+scheduled_event_delete-28event-29"><code>scheduled_event_cancel(event)</code>, <code>scheduled_event_delete(event)</code></h4>
<p>Fires when a scheduled event is canceled or deleted.</p>
<p>| Parameter | Type | Description | | ——— | ————————- | —————————- | | <code>event</code> | <span class='object_link'><a href="Discorb/ScheduledEvent.html" title="Discorb::ScheduledEvent (class)">Discorb::ScheduledEvent</a></span> | The deleted scheduled event. |</p>
<h4 id="label-scheduled_event_edit-28before-2C+after-29"><code>scheduled_event_edit(before, after)</code></h4>
<p>Fires when a scheduled event is edited.</p>
<p>| Parameter | Type | Description | | ——— | ————————- | ———————————— | | <code>before</code> | <span class='object_link'><a href="Discorb/ScheduledEvent.html" title="Discorb::ScheduledEvent (class)">Discorb::ScheduledEvent</a></span> | The scheduled event before the edit. | | <code>after</code> | <span class='object_link'><a href="Discorb/ScheduledEvent.html" title="Discorb::ScheduledEvent (class)">Discorb::ScheduledEvent</a></span> | The scheduled event after the edit. |</p>
<h4 id="label-scheduled_event_start-28event-29"><code>scheduled_event_start(event)</code></h4>
<p>Fires when a scheduled event is started.</p>
<p>| Parameter | Type | Description | | ——— | ————————- | ——————————— | | <code>event</code> | <span class='object_link'><a href="Discorb/ScheduledEvent.html" title="Discorb::ScheduledEvent (class)">Discorb::ScheduledEvent</a></span> | The scheduled event that started. |</p>
<h4 id="label-scheduled_event_end-28event-29"><code>scheduled_event_end(event)</code></h4>
<p>Fires when a scheduled event is ended.</p>
<p>| Parameter | Type | Description | | ——— | ————————- | ——————————- | | <code>event</code> | <span class='object_link'><a href="Discorb/ScheduledEvent.html" title="Discorb::ScheduledEvent (class)">Discorb::ScheduledEvent</a></span> | The scheduled event that ended. |</p>
<h3 id="label-Automod+events">Automod events</h3>
<h4 id="label-auto_moderation_rule_create-28rule-29"><code>auto_moderation_rule_create(rule)</code></h4>
<p>Fires when an auto moderation rule is created.</p>
<p>| Parameter | Type | Description | | ——— | ———————- | ——————————— | | <code>rule</code> | <span class='object_link'><a href="Discorb/AutoModRule.html" title="Discorb::AutoModRule (class)">Discorb::AutoModRule</a></span> | The created auto moderation rule. |</p>
<h4 id="label-auto_moderation_rule_update-28rule-29"><code>auto_moderation_rule_update(rule)</code></h4>
<p>Fires when an auto moderation rule is updated.</p>
<p>| Parameter | Type | Description | | ——— | ———————- | ——————————— | | <code>rule</code> | <span class='object_link'><a href="Discorb/AutoModRule.html" title="Discorb::AutoModRule (class)">Discorb::AutoModRule</a></span> | The updated auto moderation rule. |</p>
<h4 id="label-auto_moderation_rule_delete-28rule-29"><code>auto_moderation_rule_delete(rule)</code></h4>
<p>Fires when an auto moderation rule is deleted.</p>
<p>| Parameter | Type | Description | | ——— | ———————- | ——————————— | | <code>rule</code> | <span class='object_link'><a href="Discorb/AutoModRule.html" title="Discorb::AutoModRule (class)">Discorb::AutoModRule</a></span> | The deleted auto moderation rule. |</p>
<h4 id="label-auto_moderation_action_execution-28event-29"><code>auto_moderation_action_execution(event)</code></h4>
<p>| Parameter | Type | Description | | ——— | —————————————————— | ————————– | | <code>event</code> | <span class='object_link'><a href="Discorb/Gateway/AutoModerationActionExecutionEvent.html" title="Discorb::Gateway::AutoModerationActionExecutionEvent (class)">Discorb::Gateway::AutoModerationActionExecutionEvent</a></span> | The auto moderation event. |</p>
<h3 id="label-Low-level+events">Low-level events</h3>
<h4 id="label-guild_create-28guild-29"><code>guild_create(guild)</code></h4>
<p>Fires when <code>GUILD_CREATE</code> is received.</p>
<p>| Parameter | Type | Description | | ——— | —————- | ———————– | | <code>guild</code> | <span class='object_link'><a href="Discorb/Guild.html" title="Discorb::Guild (class)">Discorb::Guild</a></span> | The guild of the event. |</p>
<h4 id="label-guild_delete-28guild-29"><code>guild_delete(guild)</code></h4>
<p>Fires when <code>GUILD_DELETE</code> is received.</p>
<p>| Parameter | Type | Description | | ——— | —————- | ———————– | | <code>guild</code> | <span class='object_link'><a href="Discorb/Guild.html" title="Discorb::Guild (class)">Discorb::Guild</a></span> | The guild of the event. |</p>
<h4 id="label-thread_create-28thread-29"><code>thread_create(thread)</code></h4>
<p>Fires when <code>THREAD_CREATE</code> is received.</p>
<p>| Parameter | Type | Description | | ——— | ———————— | ———————— | | <code>thread</code> | <span class='object_link'><a href="Discorb/ThreadChannel.html" title="Discorb::ThreadChannel (class)">Discorb::ThreadChannel</a></span> | The thread of the event. |</p>
<h4 id="label-scheduled_event_update-28before-2C+after-29"><code>scheduled_event_update(before, after)</code></h4>
<p>Fires when <code>SCHEDULED_EVENT_UPDATE</code> is received.</p>
<p>| Parameter | Type | Description | | ——— | ————————- | ————————————– | | <code>before</code> | <span class='object_link'><a href="Discorb/ScheduledEvent.html" title="Discorb::ScheduledEvent (class)">Discorb::ScheduledEvent</a></span> | The scheduled event before the update. | | <code>after</code> | <span class='object_link'><a href="Discorb/ScheduledEvent.html" title="Discorb::ScheduledEvent (class)">Discorb::ScheduledEvent</a></span> | The scheduled event after the update. |</p>
</div></div>
<div id="footer">
Generated on Sat Sep 3 22:19:57 2022 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.28 (ruby-3.0.2).
</div>
</div>
</body>
</html>