discorb 0.19.0 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build_version.yml +2 -2
- data/.rubocop.yml +12 -75
- data/Changelog.md +10 -0
- data/Rakefile +482 -454
- data/lib/discorb/allowed_mentions.rb +68 -72
- data/lib/discorb/app_command/command.rb +466 -398
- data/lib/discorb/app_command/common.rb +65 -25
- data/lib/discorb/app_command/handler.rb +304 -266
- data/lib/discorb/app_command.rb +5 -5
- data/lib/discorb/application.rb +198 -197
- data/lib/discorb/asset.rb +101 -101
- data/lib/discorb/attachment.rb +134 -119
- data/lib/discorb/audit_logs.rb +412 -385
- data/lib/discorb/automod.rb +279 -269
- data/lib/discorb/channel/base.rb +107 -108
- data/lib/discorb/channel/category.rb +32 -32
- data/lib/discorb/channel/container.rb +44 -44
- data/lib/discorb/channel/dm.rb +26 -28
- data/lib/discorb/channel/guild.rb +311 -246
- data/lib/discorb/channel/stage.rb +156 -140
- data/lib/discorb/channel/text.rb +430 -336
- data/lib/discorb/channel/thread.rb +374 -325
- data/lib/discorb/channel/voice.rb +85 -79
- data/lib/discorb/channel.rb +5 -5
- data/lib/discorb/client.rb +635 -621
- data/lib/discorb/color.rb +178 -182
- data/lib/discorb/common.rb +168 -164
- data/lib/discorb/components/button.rb +107 -106
- data/lib/discorb/components/select_menu.rb +157 -145
- data/lib/discorb/components/text_input.rb +103 -106
- data/lib/discorb/components.rb +68 -66
- data/lib/discorb/dictionary.rb +135 -135
- data/lib/discorb/embed.rb +404 -398
- data/lib/discorb/emoji.rb +309 -302
- data/lib/discorb/emoji_table.rb +16099 -8857
- data/lib/discorb/error.rb +131 -131
- data/lib/discorb/event.rb +360 -314
- data/lib/discorb/event_handler.rb +39 -39
- data/lib/discorb/exe/about.rb +17 -17
- data/lib/discorb/exe/irb.rb +72 -67
- data/lib/discorb/exe/new.rb +323 -315
- data/lib/discorb/exe/run.rb +69 -68
- data/lib/discorb/exe/setup.rb +57 -55
- data/lib/discorb/exe/show.rb +12 -12
- data/lib/discorb/extend.rb +25 -45
- data/lib/discorb/extension.rb +89 -83
- data/lib/discorb/flag.rb +126 -128
- data/lib/discorb/gateway.rb +984 -804
- data/lib/discorb/gateway_events.rb +670 -638
- data/lib/discorb/gateway_requests.rb +45 -48
- data/lib/discorb/guild.rb +2115 -1626
- data/lib/discorb/guild_template.rb +280 -241
- data/lib/discorb/http.rb +247 -232
- data/lib/discorb/image.rb +42 -42
- data/lib/discorb/integration.rb +169 -161
- data/lib/discorb/intents.rb +161 -163
- data/lib/discorb/interaction/autocomplete.rb +76 -62
- data/lib/discorb/interaction/command.rb +279 -224
- data/lib/discorb/interaction/components.rb +114 -104
- data/lib/discorb/interaction/modal.rb +36 -32
- data/lib/discorb/interaction/response.rb +379 -336
- data/lib/discorb/interaction/root.rb +271 -257
- data/lib/discorb/interaction.rb +5 -5
- data/lib/discorb/invite.rb +154 -153
- data/lib/discorb/member.rb +344 -311
- data/lib/discorb/message.rb +615 -544
- data/lib/discorb/message_meta.rb +197 -186
- data/lib/discorb/modules.rb +371 -290
- data/lib/discorb/permission.rb +305 -291
- data/lib/discorb/presence.rb +352 -346
- data/lib/discorb/rate_limit.rb +81 -76
- data/lib/discorb/reaction.rb +55 -54
- data/lib/discorb/role.rb +272 -240
- data/lib/discorb/shard.rb +76 -74
- data/lib/discorb/sticker.rb +193 -171
- data/lib/discorb/user.rb +205 -188
- data/lib/discorb/utils/colored_puts.rb +16 -16
- data/lib/discorb/utils.rb +12 -16
- data/lib/discorb/voice_state.rb +305 -281
- data/lib/discorb/webhook.rb +537 -507
- data/lib/discorb.rb +62 -56
- data/sig/discorb/application.rbs +2 -0
- data/sig/discorb/automod.rbs +10 -1
- data/sig/discorb/guild.rbs +2 -0
- data/sig/discorb/message.rbs +2 -0
- data/sig/discorb/user.rbs +22 -20
- metadata +2 -2
@@ -1,638 +1,670 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Discorb
|
4
|
-
module Gateway
|
5
|
-
#
|
6
|
-
# Represents an event.
|
7
|
-
# @abstract
|
8
|
-
#
|
9
|
-
class GatewayEvent
|
10
|
-
#
|
11
|
-
# Initializes a new instance of the GatewayEvent class.
|
12
|
-
# @private
|
13
|
-
#
|
14
|
-
# @param [Hash] data The data of the event.
|
15
|
-
#
|
16
|
-
def initialize(data)
|
17
|
-
@data = data
|
18
|
-
end
|
19
|
-
|
20
|
-
def inspect
|
21
|
-
"#<#{self.class}>"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
#
|
26
|
-
# Represents a reaction event.
|
27
|
-
#
|
28
|
-
class ReactionEvent < GatewayEvent
|
29
|
-
# @return [Hash] The raw data of the event.
|
30
|
-
attr_reader :data
|
31
|
-
# @return [Discorb::Snowflake] The ID of the user who reacted.
|
32
|
-
attr_reader :user_id
|
33
|
-
alias member_id user_id
|
34
|
-
# @return [Discorb::Snowflake] The ID of the channel the message was sent in.
|
35
|
-
attr_reader :channel_id
|
36
|
-
# @return [Discorb::Snowflake] The ID of the message.
|
37
|
-
attr_reader :message_id
|
38
|
-
# @return [Discorb::Snowflake] The ID of the guild the message was sent in.
|
39
|
-
attr_reader :guild_id
|
40
|
-
# @macro client_cache
|
41
|
-
# @return [Discorb::User, Discorb::Member] The user who reacted.
|
42
|
-
attr_reader :user
|
43
|
-
alias member user
|
44
|
-
# @macro client_cache
|
45
|
-
# @return [Discorb::Channel] The channel the message was sent in.
|
46
|
-
attr_reader :channel
|
47
|
-
# @macro client_cache
|
48
|
-
# @return [Discorb::Guild] The guild the message was sent in.
|
49
|
-
attr_reader :guild
|
50
|
-
# @macro client_cache
|
51
|
-
# @return [Discorb::Message] The message the reaction was sent in.
|
52
|
-
attr_reader :message
|
53
|
-
# @return [Discorb::UnicodeEmoji, Discorb::PartialEmoji] The emoji that was reacted with.
|
54
|
-
attr_reader :emoji
|
55
|
-
|
56
|
-
#
|
57
|
-
# Initializes a new instance of the ReactionEvent class.
|
58
|
-
# @private
|
59
|
-
#
|
60
|
-
# @param [Discorb::Client] client The client that instantiated the object.
|
61
|
-
# @param [Hash] data The data of the event.
|
62
|
-
#
|
63
|
-
def initialize(client, data)
|
64
|
-
@client = client
|
65
|
-
@data = data
|
66
|
-
if data.key?(:user_id)
|
67
|
-
@user_id = Snowflake.new(data[:user_id])
|
68
|
-
else
|
69
|
-
@member_data = data[:member]
|
70
|
-
end
|
71
|
-
@channel_id = Snowflake.new(data[:channel_id])
|
72
|
-
@message_id = Snowflake.new(data[:message_id])
|
73
|
-
@guild_id = Snowflake.new(data[:guild_id])
|
74
|
-
@guild = client.guilds[data[:guild_id]]
|
75
|
-
@channel = client.channels[data[:channel_id]] unless @guild.nil?
|
76
|
-
|
77
|
-
@user = client.users[data[:user_id]]
|
78
|
-
|
79
|
-
unless @guild.nil?
|
80
|
-
@user =
|
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
|
-
end
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
# @return [Discorb::
|
165
|
-
attr_reader :
|
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
|
-
# @return [Discorb::
|
219
|
-
attr_reader :
|
220
|
-
# @
|
221
|
-
|
222
|
-
|
223
|
-
# @return [Discorb::
|
224
|
-
attr_reader :
|
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
|
-
end
|
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
|
-
# @return [
|
312
|
-
attr_reader :
|
313
|
-
# @return [
|
314
|
-
attr_reader :
|
315
|
-
# @return [
|
316
|
-
attr_reader :
|
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
|
-
def
|
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
|
-
def
|
420
|
-
@client
|
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
|
-
end
|
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
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
#
|
596
|
-
|
597
|
-
|
598
|
-
# @
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
#
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
#
|
624
|
-
#
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
#
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Discorb
|
4
|
+
module Gateway
|
5
|
+
#
|
6
|
+
# Represents an event.
|
7
|
+
# @abstract
|
8
|
+
#
|
9
|
+
class GatewayEvent
|
10
|
+
#
|
11
|
+
# Initializes a new instance of the GatewayEvent class.
|
12
|
+
# @private
|
13
|
+
#
|
14
|
+
# @param [Hash] data The data of the event.
|
15
|
+
#
|
16
|
+
def initialize(data)
|
17
|
+
@data = data
|
18
|
+
end
|
19
|
+
|
20
|
+
def inspect
|
21
|
+
"#<#{self.class}>"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
#
|
26
|
+
# Represents a reaction event.
|
27
|
+
#
|
28
|
+
class ReactionEvent < GatewayEvent
|
29
|
+
# @return [Hash] The raw data of the event.
|
30
|
+
attr_reader :data
|
31
|
+
# @return [Discorb::Snowflake] The ID of the user who reacted.
|
32
|
+
attr_reader :user_id
|
33
|
+
alias member_id user_id
|
34
|
+
# @return [Discorb::Snowflake] The ID of the channel the message was sent in.
|
35
|
+
attr_reader :channel_id
|
36
|
+
# @return [Discorb::Snowflake] The ID of the message.
|
37
|
+
attr_reader :message_id
|
38
|
+
# @return [Discorb::Snowflake] The ID of the guild the message was sent in.
|
39
|
+
attr_reader :guild_id
|
40
|
+
# @macro client_cache
|
41
|
+
# @return [Discorb::User, Discorb::Member] The user who reacted.
|
42
|
+
attr_reader :user
|
43
|
+
alias member user
|
44
|
+
# @macro client_cache
|
45
|
+
# @return [Discorb::Channel] The channel the message was sent in.
|
46
|
+
attr_reader :channel
|
47
|
+
# @macro client_cache
|
48
|
+
# @return [Discorb::Guild] The guild the message was sent in.
|
49
|
+
attr_reader :guild
|
50
|
+
# @macro client_cache
|
51
|
+
# @return [Discorb::Message] The message the reaction was sent in.
|
52
|
+
attr_reader :message
|
53
|
+
# @return [Discorb::UnicodeEmoji, Discorb::PartialEmoji] The emoji that was reacted with.
|
54
|
+
attr_reader :emoji
|
55
|
+
|
56
|
+
#
|
57
|
+
# Initializes a new instance of the ReactionEvent class.
|
58
|
+
# @private
|
59
|
+
#
|
60
|
+
# @param [Discorb::Client] client The client that instantiated the object.
|
61
|
+
# @param [Hash] data The data of the event.
|
62
|
+
#
|
63
|
+
def initialize(client, data)
|
64
|
+
@client = client
|
65
|
+
@data = data
|
66
|
+
if data.key?(:user_id)
|
67
|
+
@user_id = Snowflake.new(data[:user_id])
|
68
|
+
else
|
69
|
+
@member_data = data[:member]
|
70
|
+
end
|
71
|
+
@channel_id = Snowflake.new(data[:channel_id])
|
72
|
+
@message_id = Snowflake.new(data[:message_id])
|
73
|
+
@guild_id = Snowflake.new(data[:guild_id])
|
74
|
+
@guild = client.guilds[data[:guild_id]]
|
75
|
+
@channel = client.channels[data[:channel_id]] unless @guild.nil?
|
76
|
+
|
77
|
+
@user = client.users[data[:user_id]]
|
78
|
+
|
79
|
+
unless @guild.nil?
|
80
|
+
@user =
|
81
|
+
if data.key?(:member)
|
82
|
+
@guild.members[data[:member][:user][:id]] ||
|
83
|
+
Member.new(
|
84
|
+
@client,
|
85
|
+
@guild_id,
|
86
|
+
data[:member][:user],
|
87
|
+
data[:member]
|
88
|
+
)
|
89
|
+
else
|
90
|
+
@guild.members[data[:user_id]]
|
91
|
+
end || @user
|
92
|
+
end
|
93
|
+
|
94
|
+
@message = client.messages[data[:message_id]]
|
95
|
+
@emoji =
|
96
|
+
(
|
97
|
+
if data[:emoji][:id].nil?
|
98
|
+
UnicodeEmoji.new(data[:emoji][:name])
|
99
|
+
else
|
100
|
+
PartialEmoji.new(data[:emoji])
|
101
|
+
end
|
102
|
+
)
|
103
|
+
end
|
104
|
+
|
105
|
+
# Fetch the message.
|
106
|
+
# If message is cached, it will be returned.
|
107
|
+
# @async
|
108
|
+
#
|
109
|
+
# @param [Boolean] force Whether to force fetching the message.
|
110
|
+
#
|
111
|
+
# @return [Async::Task<Discorb::Message>] The message.
|
112
|
+
def fetch_message(force: false)
|
113
|
+
Async do
|
114
|
+
next @message if !force && @message
|
115
|
+
|
116
|
+
@message = @channel.fetch_message(@message_id).wait
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
#
|
122
|
+
# Represents a `INTEGRATION_DELETE` event.
|
123
|
+
#
|
124
|
+
class IntegrationDeleteEvent < GatewayEvent
|
125
|
+
# @return [Discorb::Snowflake] The ID of the integration.
|
126
|
+
attr_reader :id
|
127
|
+
|
128
|
+
# @!attribute [r] guild
|
129
|
+
# @macro client_cache
|
130
|
+
# @return [Discorb::Guild] The guild of the integration.
|
131
|
+
# @!attribute [r] user
|
132
|
+
# @macro client_cache
|
133
|
+
# @return [Discorb::User] The user associated with the integration.
|
134
|
+
|
135
|
+
#
|
136
|
+
# Initialize a new instance of the IntegrationDeleteEvent class.
|
137
|
+
# @private
|
138
|
+
#
|
139
|
+
#
|
140
|
+
# @param [Hash] data The data of the event.
|
141
|
+
#
|
142
|
+
#
|
143
|
+
def initialize(_client, data)
|
144
|
+
@id = Snowflake.new(data[:id])
|
145
|
+
@guild_id = data[:guild_id]
|
146
|
+
@user_id = data[:application_id]
|
147
|
+
end
|
148
|
+
|
149
|
+
def guild
|
150
|
+
@client.guilds[@guild_id]
|
151
|
+
end
|
152
|
+
|
153
|
+
def user
|
154
|
+
@client.users[@user_id]
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
#
|
159
|
+
# Represents a `MESSAGE_REACTION_REMOVE_ALL` event.
|
160
|
+
#
|
161
|
+
class ReactionRemoveAllEvent < GatewayEvent
|
162
|
+
# @return [Discorb::Snowflake] The ID of the channel the message was sent in.
|
163
|
+
attr_reader :channel_id
|
164
|
+
# @return [Discorb::Snowflake] The ID of the message.
|
165
|
+
attr_reader :message_id
|
166
|
+
# @return [Discorb::Snowflake] The ID of the guild the message was sent in.
|
167
|
+
attr_reader :guild_id
|
168
|
+
# @macro client_cache
|
169
|
+
# @return [Discorb::Channel] The channel the message was sent in.
|
170
|
+
attr_reader :channel
|
171
|
+
# @macro client_cache
|
172
|
+
# @return [Discorb::Guild] The guild the message was sent in.
|
173
|
+
attr_reader :guild
|
174
|
+
# @macro client_cache
|
175
|
+
# @return [Discorb::Message] The message the reaction was sent in.
|
176
|
+
attr_reader :message
|
177
|
+
|
178
|
+
#
|
179
|
+
# Initialize a new instance of the ReactionRemoveAllEvent class.
|
180
|
+
# @private
|
181
|
+
#
|
182
|
+
# @param [Discorb::Client] client The client that instantiated the object.
|
183
|
+
# @param [Hash] data The data of the event.
|
184
|
+
#
|
185
|
+
def initialize(client, data)
|
186
|
+
@client = client
|
187
|
+
@data = data
|
188
|
+
@guild_id = Snowflake.new(data[:guild_id])
|
189
|
+
@channel_id = Snowflake.new(data[:channel_id])
|
190
|
+
@message_id = Snowflake.new(data[:message_id])
|
191
|
+
@guild = client.guilds[data[:guild_id]]
|
192
|
+
@channel = client.channels[data[:channel_id]]
|
193
|
+
@message = client.messages[data[:message_id]]
|
194
|
+
end
|
195
|
+
|
196
|
+
# Fetch the message.
|
197
|
+
# If message is cached, it will be returned.
|
198
|
+
# @async
|
199
|
+
#
|
200
|
+
# @param [Boolean] force Whether to force fetching the message.
|
201
|
+
#
|
202
|
+
# @return [Async::Task<Discorb::Message>] The message.
|
203
|
+
def fetch_message(force: false)
|
204
|
+
Async do
|
205
|
+
next @message if !force && @message
|
206
|
+
|
207
|
+
@message = @channel.fetch_message(@message_id).wait
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
#
|
213
|
+
# Represents a `MESSAGE_REACTION_REMOVE_EMOJI` event.
|
214
|
+
#
|
215
|
+
class ReactionRemoveEmojiEvent < GatewayEvent
|
216
|
+
# @return [Discorb::Snowflake] The ID of the channel the message was sent in.
|
217
|
+
attr_reader :channel_id
|
218
|
+
# @return [Discorb::Snowflake] The ID of the message.
|
219
|
+
attr_reader :message_id
|
220
|
+
# @return [Discorb::Snowflake] The ID of the guild the message was sent in.
|
221
|
+
attr_reader :guild_id
|
222
|
+
# @macro client_cache
|
223
|
+
# @return [Discorb::Channel] The channel the message was sent in.
|
224
|
+
attr_reader :channel
|
225
|
+
# @macro client_cache
|
226
|
+
# @return [Discorb::Guild] The guild the message was sent in.
|
227
|
+
attr_reader :guild
|
228
|
+
# @macro client_cache
|
229
|
+
# @return [Discorb::Message] The message the reaction was sent in.
|
230
|
+
attr_reader :message
|
231
|
+
# @return [Discorb::UnicodeEmoji, Discorb::PartialEmoji] The emoji that was reacted with.
|
232
|
+
attr_reader :emoji
|
233
|
+
|
234
|
+
#
|
235
|
+
# Initialize a new instance of the ReactionRemoveEmojiEvent class.
|
236
|
+
# @private
|
237
|
+
#
|
238
|
+
# @param [Discorb::Client] client The client that instantiated the object.
|
239
|
+
# @param [Hash] data The data of the event.
|
240
|
+
#
|
241
|
+
def initialize(client, data)
|
242
|
+
@client = client
|
243
|
+
@data = data
|
244
|
+
@guild_id = Snowflake.new(data[:guild_id])
|
245
|
+
@channel_id = Snowflake.new(data[:channel_id])
|
246
|
+
@message_id = Snowflake.new(data[:message_id])
|
247
|
+
@guild = client.guilds[data[:guild_id]]
|
248
|
+
@channel = client.channels[data[:channel_id]]
|
249
|
+
@message = client.messages[data[:message_id]]
|
250
|
+
@emoji =
|
251
|
+
(
|
252
|
+
if data[:emoji][:id].nil?
|
253
|
+
DiscordEmoji.new(data[:emoji][:name])
|
254
|
+
else
|
255
|
+
PartialEmoji.new(data[:emoji])
|
256
|
+
end
|
257
|
+
)
|
258
|
+
end
|
259
|
+
|
260
|
+
# Fetch the message.
|
261
|
+
# If message is cached, it will be returned.
|
262
|
+
# @async
|
263
|
+
#
|
264
|
+
# @param [Boolean] force Whether to force fetching the message.
|
265
|
+
#
|
266
|
+
# @return [Async::Task<Discorb::Message>] The message.
|
267
|
+
def fetch_message(force: false)
|
268
|
+
Async do
|
269
|
+
next @message if !force && @message
|
270
|
+
|
271
|
+
@message = @channel.fetch_message(@message_id).wait
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
#
|
277
|
+
# Represents a `GUILD_SCHEDULED_EVENT_USER_ADD` and `GUILD_SCHEDULED_EVENT_USER_REMOVE` event.
|
278
|
+
#
|
279
|
+
class ScheduledEventUserEvent < GatewayEvent
|
280
|
+
# @return [Discorb::User] The user that triggered the event.
|
281
|
+
attr_reader :user
|
282
|
+
# @return [Discorb::Guild] The guild the event was triggered in.
|
283
|
+
attr_reader :guild
|
284
|
+
# @return [Discorb::ScheduledEvent] The scheduled event.
|
285
|
+
attr_reader :scheduled_event
|
286
|
+
|
287
|
+
#
|
288
|
+
# Initialize a new instance of the ScheduledEventUserEvent class.
|
289
|
+
# @private
|
290
|
+
#
|
291
|
+
# @param [Discorb::Client] client The client that instantiated the object.
|
292
|
+
# @param [Hash] data The data of the event.
|
293
|
+
#
|
294
|
+
def initialize(client, data)
|
295
|
+
@client = client
|
296
|
+
@scheduled_event_id = Snowflake.new(data[:scheduled_event_id])
|
297
|
+
@user_id = Snowflake.new(data[:user_id])
|
298
|
+
@guild_id = Snowflake.new(data[:guild_id])
|
299
|
+
@guild = client.guilds[data[:guild_id]]
|
300
|
+
@scheduled_event = @guild.scheduled_events[@scheduled_event_id]
|
301
|
+
@user = client.users[data[:user_id]]
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
#
|
306
|
+
# Represents a `MESSAGE_UPDATE` event.
|
307
|
+
#
|
308
|
+
class MessageUpdateEvent < GatewayEvent
|
309
|
+
# @return [Discorb::Message] The message before update.
|
310
|
+
attr_reader :before
|
311
|
+
# @return [Discorb::Message] The message after update.
|
312
|
+
attr_reader :after
|
313
|
+
# @return [Discorb::Snowflake] The ID of the message.
|
314
|
+
attr_reader :id
|
315
|
+
# @return [Discorb::Snowflake] The ID of the channel the message was sent in.
|
316
|
+
attr_reader :channel_id
|
317
|
+
# @return [Discorb::Snowflake] The ID of the guild the message was sent in.
|
318
|
+
attr_reader :guild_id
|
319
|
+
# @return [String] The new content of the message.
|
320
|
+
attr_reader :content
|
321
|
+
# @return [Time] The time the message was edited.
|
322
|
+
attr_reader :timestamp
|
323
|
+
# @return [Boolean] Whether the message pings @everyone.
|
324
|
+
attr_reader :mention_everyone
|
325
|
+
# @macro client_cache
|
326
|
+
# @return [Array<Discorb::Role>] The roles mentioned in the message.
|
327
|
+
attr_reader :mention_roles
|
328
|
+
# @return [Array<Discorb::Attachment>] The attachments in the message.
|
329
|
+
attr_reader :attachments
|
330
|
+
# @return [Array<Discorb::Embed>] The embeds in the message.
|
331
|
+
attr_reader :embeds
|
332
|
+
|
333
|
+
# @!attribute [r] channel
|
334
|
+
# @macro client_cache
|
335
|
+
# @return [Discorb::Channel] The channel the message was sent in.
|
336
|
+
# @!attribute [r] guild
|
337
|
+
# @macro client_cache
|
338
|
+
# @return [Discorb::Guild] The guild the message was sent in.
|
339
|
+
|
340
|
+
def initialize(client, data, before, after)
|
341
|
+
@client = client
|
342
|
+
@data = data
|
343
|
+
@before = before
|
344
|
+
@after = after
|
345
|
+
@id = Snowflake.new(data[:id])
|
346
|
+
@channel_id = Snowflake.new(data[:channel_id])
|
347
|
+
@guild_id = Snowflake.new(data[:guild_id]) if data.key?(:guild_id)
|
348
|
+
@content = data[:content]
|
349
|
+
@timestamp = Time.iso8601(data[:edited_timestamp])
|
350
|
+
@mention_everyone = data[:mention_everyone]
|
351
|
+
@mention_roles =
|
352
|
+
data[:mention_roles].map { |r| guild.roles[r] } if data.key?(
|
353
|
+
:mention_roles
|
354
|
+
)
|
355
|
+
@attachments =
|
356
|
+
data[:attachments].map { |a| Attachment.from_hash(a) } if data.key?(
|
357
|
+
:attachments
|
358
|
+
)
|
359
|
+
@embeds =
|
360
|
+
(
|
361
|
+
if data[:embeds]
|
362
|
+
data[:embeds].map { |e| Embed.from_hash(e) }
|
363
|
+
else
|
364
|
+
[]
|
365
|
+
end
|
366
|
+
) if data.key?(:embeds)
|
367
|
+
end
|
368
|
+
|
369
|
+
def channel
|
370
|
+
@client.channels[@channel_id]
|
371
|
+
end
|
372
|
+
|
373
|
+
def guild
|
374
|
+
@client.guilds[@guild_id]
|
375
|
+
end
|
376
|
+
|
377
|
+
# Fetch the message.
|
378
|
+
# @async
|
379
|
+
#
|
380
|
+
# @return [Async::Task<Discorb::Message>] The message.
|
381
|
+
def fetch_message
|
382
|
+
Async { channel.fetch_message(@id).wait }
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
386
|
+
#
|
387
|
+
# Represents a message but it has only ID.
|
388
|
+
#
|
389
|
+
class UnknownDeleteBulkMessage < GatewayEvent
|
390
|
+
# @return [Discorb::Snowflake] The ID of the message.
|
391
|
+
attr_reader :id
|
392
|
+
|
393
|
+
# @!attribute [r] channel
|
394
|
+
# @macro client_cache
|
395
|
+
# @return [Discorb::Channel] The channel the message was sent in.
|
396
|
+
# @!attribute [r] guild
|
397
|
+
# @macro client_cache
|
398
|
+
# @return [Discorb::Guild] The guild the message was sent in.
|
399
|
+
|
400
|
+
#
|
401
|
+
# Initialize a new instance of the UnknownDeleteBulkMessage class.
|
402
|
+
# @private
|
403
|
+
#
|
404
|
+
# @param [Discorb::Client] client The client that instantiated the object.
|
405
|
+
# @param [Hash] data The data of the event.
|
406
|
+
#
|
407
|
+
def initialize(client, id, data)
|
408
|
+
@client = client
|
409
|
+
@id = Snowflake.new(id)
|
410
|
+
@data = data
|
411
|
+
@channel_id = Snowflake.new(data[:channel_id])
|
412
|
+
@guild_id = Snowflake.new(data[:guild_id]) if data.key?(:guild_id)
|
413
|
+
end
|
414
|
+
|
415
|
+
def channel
|
416
|
+
@client.channels[@channel_id]
|
417
|
+
end
|
418
|
+
|
419
|
+
def guild
|
420
|
+
@client.guilds[@guild_id]
|
421
|
+
end
|
422
|
+
end
|
423
|
+
|
424
|
+
#
|
425
|
+
# Represents a `INVITE_DELETE` event.
|
426
|
+
#
|
427
|
+
class InviteDeleteEvent < GatewayEvent
|
428
|
+
# @return [String] The invite code.
|
429
|
+
attr_reader :code
|
430
|
+
|
431
|
+
# @!attribute [r] channel
|
432
|
+
# @macro client_cache
|
433
|
+
# @return [Discorb::Channel] The channel the message was sent in.
|
434
|
+
# @!attribute [r] guild
|
435
|
+
# @macro client_cache
|
436
|
+
# @return [Discorb::Guild] The guild the message was sent in.
|
437
|
+
|
438
|
+
#
|
439
|
+
# Initialize a new instance of the InviteDeleteEvent class.
|
440
|
+
# @private
|
441
|
+
#
|
442
|
+
# @param [Discorb::Client] client The client that instantiated the object.
|
443
|
+
# @param [Hash] data The data of the event.
|
444
|
+
#
|
445
|
+
def initialize(client, data)
|
446
|
+
@client = client
|
447
|
+
@data = data
|
448
|
+
@channel_id = Snowflake.new(data[:channel])
|
449
|
+
@guild_id = Snowflake.new(data[:guild_id])
|
450
|
+
@code = data[:code]
|
451
|
+
end
|
452
|
+
|
453
|
+
def channel
|
454
|
+
@client.channels[@channel_id]
|
455
|
+
end
|
456
|
+
|
457
|
+
def guild
|
458
|
+
@client.guilds[@guild_id]
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
462
|
+
#
|
463
|
+
# Represents a `TYPING_START` event.
|
464
|
+
#
|
465
|
+
class TypingStartEvent < GatewayEvent
|
466
|
+
# @return [Discorb::Snowflake] The ID of the channel the user is typing in.
|
467
|
+
attr_reader :user_id
|
468
|
+
|
469
|
+
# @!attribute [r] channel
|
470
|
+
# @macro client_cache
|
471
|
+
# @return [Discorb::Channel] The channel the user is typing in.
|
472
|
+
# @!attribute [r] guild
|
473
|
+
# @macro client_cache
|
474
|
+
# @return [Discorb::Guild] The guild the user is typing in.
|
475
|
+
# @!attribute [r] user
|
476
|
+
# @macro client_cache
|
477
|
+
# @return [Discorb::User, Discorb::Member] The user that is typing.
|
478
|
+
|
479
|
+
#
|
480
|
+
# Initialize a new instance of the TypingStartEvent class.
|
481
|
+
# @private
|
482
|
+
#
|
483
|
+
# @param [Discorb::Client] client The client that instantiated the object.
|
484
|
+
# @param [Hash] data The data of the event.
|
485
|
+
#
|
486
|
+
def initialize(client, data)
|
487
|
+
@client = client
|
488
|
+
@data = data
|
489
|
+
@channel_id = Snowflake.new(data[:channel_id])
|
490
|
+
@guild_id = Snowflake.new(data[:guild_id]) if data.key?(:guild_id)
|
491
|
+
@user_id = Snowflake.new(data[:user_id])
|
492
|
+
@timestamp = Time.at(data[:timestamp])
|
493
|
+
if guild
|
494
|
+
@member =
|
495
|
+
guild.members[@user_id] ||
|
496
|
+
Member.new(
|
497
|
+
@client,
|
498
|
+
@guild_id,
|
499
|
+
@client.users[@user_id].instance_variable_get(:@data),
|
500
|
+
data[:member]
|
501
|
+
)
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
def user
|
506
|
+
@member || guild&.members&.[](@user_id) || @client.users[@user_id]
|
507
|
+
end
|
508
|
+
|
509
|
+
alias member user
|
510
|
+
|
511
|
+
def channel
|
512
|
+
@client.channels[@channel_id]
|
513
|
+
end
|
514
|
+
|
515
|
+
def guild
|
516
|
+
@client.guilds[@guild_id]
|
517
|
+
end
|
518
|
+
end
|
519
|
+
|
520
|
+
#
|
521
|
+
# Represents a message pin event.
|
522
|
+
#
|
523
|
+
class MessagePinEvent < GatewayEvent
|
524
|
+
# @return [Discorb::Message] The message that was pinned.
|
525
|
+
attr_reader :message
|
526
|
+
# @return [:pinned, :unpinned] The type of event.
|
527
|
+
attr_reader :type
|
528
|
+
|
529
|
+
# @!attribute [r] pinned?
|
530
|
+
# @return [Boolean] Whether the message was pinned.
|
531
|
+
# @!attribute [r] unpinned?
|
532
|
+
# @return [Boolean] Whether the message was unpinned.
|
533
|
+
|
534
|
+
def initialize(client, data, message)
|
535
|
+
@client = client
|
536
|
+
@data = data
|
537
|
+
@message = message
|
538
|
+
@type =
|
539
|
+
if message.nil?
|
540
|
+
:unknown
|
541
|
+
elsif @message.pinned?
|
542
|
+
:pinned
|
543
|
+
else
|
544
|
+
:unpinned
|
545
|
+
end
|
546
|
+
end
|
547
|
+
|
548
|
+
def pinned?
|
549
|
+
@type == :pinned
|
550
|
+
end
|
551
|
+
|
552
|
+
def unpinned?
|
553
|
+
@type == :unpinned
|
554
|
+
end
|
555
|
+
end
|
556
|
+
|
557
|
+
#
|
558
|
+
# Represents a `WEBHOOKS_UPDATE` event.
|
559
|
+
#
|
560
|
+
class WebhooksUpdateEvent < GatewayEvent
|
561
|
+
# @!attribute [r] channel
|
562
|
+
# @macro client_cache
|
563
|
+
# @return [Discorb::Channel] The channel where the webhook was updated.
|
564
|
+
# @!attribute [r] guild
|
565
|
+
# @macro client_cache
|
566
|
+
# @return [Discorb::Guild] The guild where the webhook was updated.
|
567
|
+
|
568
|
+
#
|
569
|
+
# Initialize a new instance of the WebhooksUpdateEvent class.
|
570
|
+
# @private
|
571
|
+
#
|
572
|
+
# @param [Discorb::Client] client The client that instantiated the object.
|
573
|
+
# @param [Hash] data The data of the event.
|
574
|
+
#
|
575
|
+
def initialize(client, data)
|
576
|
+
@client = client
|
577
|
+
@data = data
|
578
|
+
@guild_id = Snowflake.new(data[:guild_id])
|
579
|
+
@channel_id = Snowflake.new(data[:channel_id])
|
580
|
+
end
|
581
|
+
|
582
|
+
def guild
|
583
|
+
@client.guilds[@guild_id]
|
584
|
+
end
|
585
|
+
|
586
|
+
def channel
|
587
|
+
@client.channels[@channel_id]
|
588
|
+
end
|
589
|
+
end
|
590
|
+
|
591
|
+
#
|
592
|
+
# Represents a `AUTO_MODERATION_ACTION_EXECUTION` event.
|
593
|
+
#
|
594
|
+
class AutoModerationActionExecutionEvent < GatewayEvent
|
595
|
+
# @return [Discorb::Snowflake] The id of the rule.
|
596
|
+
attr_reader :rule_id
|
597
|
+
|
598
|
+
# @return [Symbol] The type of action that was executed.
|
599
|
+
attr_reader :rule_trigger_type
|
600
|
+
|
601
|
+
# @return [Discorb::Snowflake] The id of the message that triggered the action.
|
602
|
+
# @return [nil] If the message was deleted.
|
603
|
+
attr_reader :message_id
|
604
|
+
|
605
|
+
# @return [Discorb::Snowflake] The id of the system message that was sent.
|
606
|
+
# @return [nil] If the system message channel was not set.
|
607
|
+
attr_reader :alert_system_message_id
|
608
|
+
|
609
|
+
# @return [String] The content of the message that was sent.
|
610
|
+
attr_reader :content
|
611
|
+
|
612
|
+
# @return [String] The keyword that triggered the action.
|
613
|
+
# @return [nil] If the action was not triggered by a keyword.
|
614
|
+
attr_reader :matched_keyword
|
615
|
+
|
616
|
+
# @return [String] The content that triggered the action.
|
617
|
+
# @return [nil] If the action was not triggered by a keyword.
|
618
|
+
attr_reader :matched_content
|
619
|
+
|
620
|
+
# @return [Discorb::AutoModRule::Action] The action that was executed.
|
621
|
+
attr_reader :action
|
622
|
+
|
623
|
+
#
|
624
|
+
# Initialize a new instance of the AutoModerationActionExecutionEvent class.
|
625
|
+
# @private
|
626
|
+
#
|
627
|
+
# @param [Discorb::Client] client The client that instantiated the object.
|
628
|
+
# @param [Hash] data The data of the event.
|
629
|
+
#
|
630
|
+
def initialize(client, data)
|
631
|
+
@client = client
|
632
|
+
@data = data
|
633
|
+
@rule_id = Snowflake.new(data[:rule_id])
|
634
|
+
@rule_trigger_type =
|
635
|
+
Discorb::AutoModRule::TRIGGER_TYPES[data[:rule_trigger_type]]
|
636
|
+
@action = Discorb::AutoModRule::Action.new(data[:action])
|
637
|
+
@user_id = Snowflake.new(data[:user_id])
|
638
|
+
@guild_id = Snowflake.new(data[:guild_id])
|
639
|
+
@channel_id = data[:channel_id] && Snowflake.new(data[:channel_id])
|
640
|
+
@message_id = data[:message_id] && Snowflake.new(data[:message_id])
|
641
|
+
@alert_system_message_id =
|
642
|
+
data[:alert_system_message_id] &&
|
643
|
+
Snowflake.new(data[:alert_system_message_id])
|
644
|
+
@content = data[:content]
|
645
|
+
@matched_keyword = data[:matched_keyword]
|
646
|
+
@matched_content = data[:matched_content]
|
647
|
+
end
|
648
|
+
|
649
|
+
# @!attribute [r] guild
|
650
|
+
# @return [Discorb::Guild] The guild where the rule was executed.
|
651
|
+
def guild
|
652
|
+
@client.guilds[@guild_id]
|
653
|
+
end
|
654
|
+
|
655
|
+
# @!attribute [r] channel
|
656
|
+
# @return [Discorb::Channel] The channel where the rule was executed.
|
657
|
+
def channel
|
658
|
+
@client.channels[@channel_id]
|
659
|
+
end
|
660
|
+
|
661
|
+
# @!attribute [r] member
|
662
|
+
# @return [Discorb::Member] The member that triggered the action.
|
663
|
+
def member
|
664
|
+
guild.members[@user_id]
|
665
|
+
end
|
666
|
+
|
667
|
+
alias user member
|
668
|
+
end
|
669
|
+
end
|
670
|
+
end
|