discorb 0.16.0 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +1 -0
  3. data/.github/workflows/build_main.yml +2 -2
  4. data/.github/workflows/build_version.yml +1 -1
  5. data/.github/workflows/codeql-analysis.yml +1 -1
  6. data/.github/workflows/lint-push.yml +3 -5
  7. data/.github/workflows/lint.yml +2 -4
  8. data/.github/workflows/spec.yml +33 -0
  9. data/.github/workflows/validate.yml +21 -0
  10. data/.gitignore +2 -0
  11. data/.lefthook/commit-msg/validator.rb +5 -0
  12. data/.rspec +2 -0
  13. data/.rspec_parallel +2 -0
  14. data/.rubocop.yml +43 -6
  15. data/Changelog.md +30 -1
  16. data/Gemfile +20 -8
  17. data/Rakefile +226 -98
  18. data/Steepfile +28 -0
  19. data/bin/console +3 -3
  20. data/docs/Examples.md +1 -1
  21. data/docs/application_command.md +156 -47
  22. data/docs/cli/irb.md +2 -2
  23. data/docs/cli/new.md +14 -9
  24. data/docs/cli/run.md +7 -11
  25. data/docs/cli.md +17 -10
  26. data/docs/events.md +247 -213
  27. data/docs/extension.md +1 -2
  28. data/docs/faq.md +0 -1
  29. data/docs/tutorial.md +18 -18
  30. data/docs/voice_events.md +106 -106
  31. data/examples/commands/message.rb +68 -0
  32. data/examples/commands/permission.rb +19 -0
  33. data/examples/commands/slash.rb +48 -0
  34. data/examples/commands/user.rb +54 -0
  35. data/examples/components/authorization_button.rb +4 -3
  36. data/examples/components/select_menu.rb +6 -3
  37. data/examples/extension/main.rb +2 -1
  38. data/examples/extension/message_expander.rb +6 -2
  39. data/examples/sig/commands/message.rbs +5 -0
  40. data/examples/simple/eval.rb +3 -2
  41. data/examples/simple/ping_pong.rb +2 -1
  42. data/examples/simple/rolepanel.rb +17 -6
  43. data/examples/simple/shard.rb +3 -2
  44. data/examples/simple/wait_for_message.rb +4 -1
  45. data/exe/discorb +33 -18
  46. data/lefthook.yml +45 -0
  47. data/lib/discorb/allowed_mentions.rb +2 -1
  48. data/lib/discorb/app_command/command.rb +130 -72
  49. data/lib/discorb/app_command/common.rb +25 -0
  50. data/lib/discorb/app_command/handler.rb +130 -33
  51. data/lib/discorb/app_command.rb +2 -1
  52. data/lib/discorb/application.rb +1 -0
  53. data/lib/discorb/asset.rb +1 -2
  54. data/lib/discorb/attachment.rb +1 -1
  55. data/lib/discorb/audit_logs.rb +19 -10
  56. data/lib/discorb/automod.rb +269 -0
  57. data/lib/discorb/channel/base.rb +108 -0
  58. data/lib/discorb/channel/category.rb +32 -0
  59. data/lib/discorb/channel/container.rb +44 -0
  60. data/lib/discorb/channel/dm.rb +28 -0
  61. data/lib/discorb/channel/guild.rb +246 -0
  62. data/lib/discorb/channel/stage.rb +140 -0
  63. data/lib/discorb/channel/text.rb +336 -0
  64. data/lib/discorb/channel/thread.rb +325 -0
  65. data/lib/discorb/channel/voice.rb +79 -0
  66. data/lib/discorb/channel.rb +2 -1165
  67. data/lib/discorb/client.rb +50 -36
  68. data/lib/discorb/color.rb +37 -60
  69. data/lib/discorb/common.rb +2 -1
  70. data/lib/discorb/components/button.rb +2 -1
  71. data/lib/discorb/components/select_menu.rb +4 -2
  72. data/lib/discorb/components/text_input.rb +12 -2
  73. data/lib/discorb/components.rb +1 -1
  74. data/lib/discorb/dictionary.rb +1 -1
  75. data/lib/discorb/embed.rb +26 -10
  76. data/lib/discorb/emoji.rb +31 -4
  77. data/lib/discorb/emoji_table.rb +4969 -3
  78. data/lib/discorb/event.rb +29 -4
  79. data/lib/discorb/exe/about.rb +2 -1
  80. data/lib/discorb/exe/irb.rb +2 -4
  81. data/lib/discorb/exe/new.rb +89 -26
  82. data/lib/discorb/exe/run.rb +8 -22
  83. data/lib/discorb/exe/setup.rb +25 -12
  84. data/lib/discorb/exe/show.rb +4 -3
  85. data/lib/discorb/extend.rb +1 -0
  86. data/lib/discorb/extension.rb +6 -7
  87. data/lib/discorb/flag.rb +13 -2
  88. data/lib/discorb/gateway.rb +79 -589
  89. data/lib/discorb/gateway_events.rb +638 -0
  90. data/lib/discorb/guild.rb +318 -67
  91. data/lib/discorb/guild_template.rb +11 -5
  92. data/lib/discorb/http.rb +53 -24
  93. data/lib/discorb/integration.rb +4 -1
  94. data/lib/discorb/intents.rb +28 -19
  95. data/lib/discorb/interaction/autocomplete.rb +28 -16
  96. data/lib/discorb/interaction/command.rb +42 -14
  97. data/lib/discorb/interaction/components.rb +5 -2
  98. data/lib/discorb/interaction/modal.rb +0 -1
  99. data/lib/discorb/interaction/response.rb +125 -26
  100. data/lib/discorb/interaction/root.rb +13 -13
  101. data/lib/discorb/interaction.rb +1 -0
  102. data/lib/discorb/invite.rb +5 -2
  103. data/lib/discorb/member.rb +28 -8
  104. data/lib/discorb/message.rb +60 -25
  105. data/lib/discorb/message_meta.rb +3 -3
  106. data/lib/discorb/modules.rb +59 -16
  107. data/lib/discorb/presence.rb +2 -0
  108. data/lib/discorb/rate_limit.rb +7 -2
  109. data/lib/discorb/reaction.rb +2 -2
  110. data/lib/discorb/role.rb +20 -5
  111. data/lib/discorb/shard.rb +1 -1
  112. data/lib/discorb/sticker.rb +9 -8
  113. data/lib/discorb/user.rb +4 -3
  114. data/lib/discorb/utils/colored_puts.rb +1 -0
  115. data/lib/discorb/voice_state.rb +6 -2
  116. data/lib/discorb/webhook.rb +64 -31
  117. data/lib/discorb.rb +7 -5
  118. data/po/yard.pot +20 -20
  119. data/rbs_collection.lock.yaml +88 -0
  120. data/rbs_collection.yaml +21 -0
  121. data/sig/async.rbs +11 -0
  122. data/sig/discorb/activity.rbs +23 -0
  123. data/sig/discorb/allowed_mentions.rbs +44 -0
  124. data/sig/discorb/app_command/base.rbs +282 -0
  125. data/sig/discorb/app_command/handler.rbs +171 -0
  126. data/sig/discorb/application.rbs +142 -0
  127. data/sig/discorb/asset.rbs +32 -0
  128. data/sig/discorb/attachment.rbs +91 -0
  129. data/sig/discorb/audit_log.rbs +231 -0
  130. data/sig/discorb/automod.rbs +128 -0
  131. data/sig/discorb/avatar.rbs +26 -0
  132. data/sig/discorb/channel/base.rbs +179 -0
  133. data/sig/discorb/channel/category.rbs +56 -0
  134. data/sig/discorb/channel/container.rbs +29 -0
  135. data/sig/discorb/channel/dm.rbs +14 -0
  136. data/sig/discorb/channel/news.rbs +20 -0
  137. data/sig/discorb/channel/stage.rbs +77 -0
  138. data/sig/discorb/channel/text.rbs +158 -0
  139. data/sig/discorb/channel/thread.rbs +185 -0
  140. data/sig/discorb/channel/voice.rbs +41 -0
  141. data/sig/discorb/client.rbs +2495 -0
  142. data/sig/discorb/color.rbs +142 -0
  143. data/sig/discorb/component/base.rbs +28 -0
  144. data/sig/discorb/component/button.rbs +65 -0
  145. data/sig/discorb/component/select_menu.rbs +107 -0
  146. data/sig/discorb/component/text_input.rbs +69 -0
  147. data/sig/discorb/connectable.rbs +8 -0
  148. data/sig/discorb/custom_emoji.rbs +90 -0
  149. data/sig/discorb/dictionary.rbs +85 -0
  150. data/sig/discorb/discord_model.rbs +15 -0
  151. data/sig/discorb/embed.rbs +279 -0
  152. data/sig/discorb/emoji.rbs +13 -0
  153. data/sig/discorb/error.rbs +73 -0
  154. data/sig/discorb/event_handler.rbs +27 -0
  155. data/sig/discorb/extension.rbs +1734 -0
  156. data/sig/discorb/flag.rbs +72 -0
  157. data/sig/discorb/gateway.rbs +481 -0
  158. data/sig/discorb/guild.rbs +870 -0
  159. data/sig/discorb/guild_template.rbs +174 -0
  160. data/sig/discorb/http.rbs +147 -0
  161. data/sig/discorb/image.rbs +20 -0
  162. data/sig/discorb/integration.rbs +118 -0
  163. data/sig/discorb/intents.rbs +97 -0
  164. data/sig/discorb/interaction/autocomplete.rbs +9 -0
  165. data/sig/discorb/interaction/base.rbs +66 -0
  166. data/sig/discorb/interaction/command.rbs +66 -0
  167. data/sig/discorb/interaction/message_component.rbs +140 -0
  168. data/sig/discorb/interaction/modal.rbs +50 -0
  169. data/sig/discorb/interaction/responder.rbs +157 -0
  170. data/sig/discorb/invite.rbs +86 -0
  171. data/sig/discorb/member.rbs +187 -0
  172. data/sig/discorb/message.rbs +469 -0
  173. data/sig/discorb/messageable.rbs +153 -0
  174. data/sig/discorb/partial_emoji.rbs +35 -0
  175. data/sig/discorb/permissions.rbs +149 -0
  176. data/sig/discorb/presence.rbs +237 -0
  177. data/sig/discorb/reaction.rbs +33 -0
  178. data/sig/discorb/role.rbs +145 -0
  179. data/sig/discorb/scheduled_event.rbs +148 -0
  180. data/sig/discorb/shard.rbs +62 -0
  181. data/sig/discorb/snowflake.rbs +56 -0
  182. data/sig/discorb/stage_instance.rbs +63 -0
  183. data/sig/discorb/sticker.rbs +116 -0
  184. data/sig/discorb/system_channel_flag.rbs +17 -0
  185. data/sig/discorb/unicode_emoji.rbs +49 -0
  186. data/sig/discorb/user.rbs +93 -0
  187. data/sig/discorb/utils.rbs +8 -0
  188. data/sig/discorb/voice_region.rbs +30 -0
  189. data/sig/discorb/voice_state.rbs +71 -0
  190. data/sig/discorb/webhook.rbs +327 -0
  191. data/sig/discorb/welcome_screen.rbs +78 -0
  192. data/sig/discorb.rbs +6 -7230
  193. data/sig/manifest.yaml +3 -0
  194. data/sig/override.rbs +19 -0
  195. data/template-replace/files/css/common.css +4 -0
  196. metadata +102 -6
  197. data/examples/commands/bookmarker.rb +0 -42
  198. data/examples/commands/hello.rb +0 -10
  199. data/examples/commands/inspect.rb +0 -25
@@ -0,0 +1,1734 @@
1
+ module Discorb
2
+ #
3
+ # Abstract class to make extension.
4
+ # Include from this module to make your own extension.
5
+ # @see file:docs/extension.md Extension
6
+ # @abstract
7
+ module Extension
8
+ def initialize: (untyped client) -> void
9
+
10
+ def events: -> untyped
11
+
12
+ def self.included: (untyped base) -> untyped
13
+
14
+ #
15
+ # @private
16
+ # Module for adding class methods to the extension class.
17
+ module ClassMethods
18
+ include Discorb::ApplicationCommand::Handler
19
+
20
+ #
21
+ # Define a new event.
22
+ #
23
+ # @param [Symbol] event_name The name of the event.
24
+ # @param [Symbol] id The id of the event. Used to delete the event.
25
+ # @param [Hash] metadata Other metadata.
26
+ #
27
+ # @return [Discorb::EventHandler] The event.
28
+ def event:
29
+ (
30
+ :event_receive event_name,
31
+ ?id: Symbol?,
32
+ **untyped metadata
33
+ ) {
34
+ (Symbol event_name, Discorb::json data) -> void
35
+ } -> void
36
+ | (
37
+ :ready event_name,
38
+ ?id: Symbol?,
39
+ **untyped metadata
40
+ ) {
41
+ -> void
42
+ } -> void
43
+ | (
44
+ :standby event_name,
45
+ ?id: Symbol?,
46
+ **untyped metadata
47
+ ) {
48
+ -> void
49
+ } -> void
50
+ | (
51
+ :resumed event_name,
52
+ ?id: Symbol?,
53
+ **untyped metadata
54
+ ) {
55
+ -> void
56
+ } -> void
57
+ | (
58
+ :error event_name,
59
+ ?id: Symbol?,
60
+ **untyped metadata
61
+ ) {
62
+ (Symbol event_name, Array[Object] args, Exception error) -> void
63
+ } -> void
64
+ | (
65
+ :setup event_name,
66
+ ?id: Symbol?,
67
+ **untyped metadata
68
+ ) {
69
+ -> void
70
+ } -> void
71
+ | (
72
+ :shard_standby event_name,
73
+ ?id: Symbol?,
74
+ **untyped metadata
75
+ ) {
76
+ (Discorb::Shard shard) -> void
77
+ } -> void
78
+ | (
79
+ :shard_resumed event_name,
80
+ ?id: Symbol?,
81
+ **untyped metadata
82
+ ) {
83
+ (Discorb::Shard shard) -> void
84
+ } -> void
85
+ | (
86
+ :guild_join event_name,
87
+ ?id: Symbol?,
88
+ **untyped metadata
89
+ ) {
90
+ (Discorb::Guild guild) -> void
91
+ } -> void
92
+ | (
93
+ :guild_available event_name,
94
+ ?id: Symbol?,
95
+ **untyped metadata
96
+ ) {
97
+ (Discorb::Guild guild) -> void
98
+ } -> void
99
+ | (
100
+ :guild_update event_name,
101
+ ?id: Symbol?,
102
+ **untyped metadata
103
+ ) {
104
+ (Discorb::Guild before, Discorb::Guild after) -> void
105
+ } -> void
106
+ | (
107
+ :guild_leave event_name,
108
+ ?id: Symbol?,
109
+ **untyped metadata
110
+ ) {
111
+ (Discorb::Guild guild) -> void
112
+ } -> void
113
+ | (
114
+ :guild_destroy event_name,
115
+ ?id: Symbol?,
116
+ **untyped metadata
117
+ ) {
118
+ (Discorb::Guild guild) -> void
119
+ } -> void
120
+ | (
121
+ :guild_integrations_update event_name,
122
+ ?id: Symbol?,
123
+ **untyped metadata
124
+ ) {
125
+ (Discorb::Guild guild) -> void
126
+ } -> void
127
+ | (
128
+ :guild_ban_add event_name,
129
+ ?id: Symbol?,
130
+ **untyped metadata
131
+ ) {
132
+ (Discorb::Guild guild, Discorb::User user) -> void
133
+ } -> void
134
+ | (
135
+ :guild_ban_remove event_name,
136
+ ?id: Symbol?,
137
+ **untyped metadata
138
+ ) {
139
+ (Discorb::Guild guild, Discorb::User user) -> void
140
+ } -> void
141
+ | (
142
+ :channel_create event_name,
143
+ ?id: Symbol?,
144
+ **untyped metadata
145
+ ) {
146
+ (Discorb::Channel channel) -> void
147
+ } -> void
148
+ | (
149
+ :channel_update event_name,
150
+ ?id: Symbol?,
151
+ **untyped metadata
152
+ ) {
153
+ (Discorb::Channel before, Discorb::Channel after) -> void
154
+ } -> void
155
+ | (
156
+ :channel_delete event_name,
157
+ ?id: Symbol?,
158
+ **untyped metadata
159
+ ) {
160
+ (Discorb::Channel channel) -> void
161
+ } -> void
162
+ | (
163
+ :webhooks_update event_name,
164
+ ?id: Symbol?,
165
+ **untyped metadata
166
+ ) {
167
+ (Discorb::Gateway::WebhooksUpdateEvent event) -> void
168
+ } -> void
169
+ | (
170
+ :thread_new event_name,
171
+ ?id: Symbol?,
172
+ **untyped metadata
173
+ ) {
174
+ (Discorb::ThreadChannel thread) -> void
175
+ } -> void
176
+ | (
177
+ :thread_join event_name,
178
+ ?id: Symbol?,
179
+ **untyped metadata
180
+ ) {
181
+ (Discorb::ThreadChannel thread) -> void
182
+ } -> void
183
+ | (
184
+ :thread_delete event_name,
185
+ ?id: Symbol?,
186
+ **untyped metadata
187
+ ) {
188
+ (Discorb::ThreadChannel thread) -> void
189
+ } -> void
190
+ | (
191
+ :thread_update event_name,
192
+ ?id: Symbol?,
193
+ **untyped metadata
194
+ ) {
195
+ (Discorb::ThreadChannel before, Discorb::ThreadChannel after) -> void
196
+ } -> void
197
+ | (
198
+ :thread_members_update event_name,
199
+ ?id: Symbol?,
200
+ **untyped metadata
201
+ ) {
202
+ (
203
+ Discorb::ThreadChannel thread,
204
+ Array[Discorb::ThreadChannel::Member] added,
205
+ Array[Discorb::ThreadChannel::Member] removed
206
+ ) -> void
207
+ } -> void
208
+ | (
209
+ :thread_member_update event_name,
210
+ ?id: Symbol?,
211
+ **untyped metadata
212
+ ) {
213
+ (
214
+ Discorb::ThreadChannel thread,
215
+ Discorb::ThreadChannel::Member before,
216
+ Discorb::ThreadChannel::Member after
217
+ ) -> void
218
+ } -> void
219
+ | (
220
+ :integration_create event_name,
221
+ ?id: Symbol?,
222
+ **untyped metadata
223
+ ) {
224
+ (Discorb::Integration integration) -> void
225
+ } -> void
226
+ | (
227
+ :integration_update event_name,
228
+ ?id: Symbol?,
229
+ **untyped metadata
230
+ ) {
231
+ (Discorb::Integration after) -> void
232
+ } -> void
233
+ | (
234
+ :integration_delete event_name,
235
+ ?id: Symbol?,
236
+ **untyped metadata
237
+ ) {
238
+ (Discorb::Integration integration) -> void
239
+ } -> void
240
+ | (
241
+ :message event_name,
242
+ ?id: Symbol?,
243
+ **untyped metadata
244
+ ) {
245
+ (Discorb::Message message) -> void
246
+ } -> void
247
+ | (
248
+ :message_update event_name,
249
+ ?id: Symbol?,
250
+ **untyped metadata
251
+ ) {
252
+ (Discorb::Gateway::MessageUpdateEvent event) -> void
253
+ } -> void
254
+ | (
255
+ :message_delete event_name,
256
+ ?id: Symbol?,
257
+ **untyped metadata
258
+ ) {
259
+ (
260
+ Discorb::Message message,
261
+ Discorb::Channel channel,
262
+ Discorb::Guild guild
263
+ ) -> void
264
+ } -> void
265
+ | (
266
+ :message_delete_id event_name,
267
+ ?id: Symbol?,
268
+ **untyped metadata
269
+ ) {
270
+ (
271
+ Discorb::Snowflake message_id,
272
+ Discorb::Channel channel,
273
+ Discorb::Guild guild
274
+ ) -> void
275
+ } -> void
276
+ | (
277
+ :message_delete_bulk event_name,
278
+ ?id: Symbol?,
279
+ **untyped metadata
280
+ ) {
281
+ (
282
+ Array[Discorb::Message
283
+ | Discorb::Gateway::UnknownDeleteBulkMessage] messages
284
+ ) -> void
285
+ } -> void
286
+ | (
287
+ :message_pin_update event_name,
288
+ ?id: Symbol?,
289
+ **untyped metadata
290
+ ) {
291
+ (Discorb::Gateway::MessagePinEvent event) -> void
292
+ } -> void
293
+ | (
294
+ :typing_start event_name,
295
+ ?id: Symbol?,
296
+ **untyped metadata
297
+ ) {
298
+ (Discorb::Gateway::TypingStartEvent event) -> void
299
+ } -> void
300
+ | (
301
+ :reaction_add event_name,
302
+ ?id: Symbol?,
303
+ **untyped metadata
304
+ ) {
305
+ (Discorb::Gateway::ReactionEvent event) -> void
306
+ } -> void
307
+ | (
308
+ :reaction_remove event_name,
309
+ ?id: Symbol?,
310
+ **untyped metadata
311
+ ) {
312
+ (Discorb::Gateway::ReactionEvent event) -> void
313
+ } -> void
314
+ | (
315
+ :reaction_remove_all event_name,
316
+ ?id: Symbol?,
317
+ **untyped metadata
318
+ ) {
319
+ (Discorb::Gateway::ReactionRemoveAllEvent event) -> void
320
+ } -> void
321
+ | (
322
+ :reaction_remove_emoji event_name,
323
+ ?id: Symbol?,
324
+ **untyped metadata
325
+ ) {
326
+ (Discorb::Gateway::ReactionRemoveEmojiEvent event) -> void
327
+ } -> void
328
+ | (
329
+ :role_create event_name,
330
+ ?id: Symbol?,
331
+ **untyped metadata
332
+ ) {
333
+ (Discorb::Role role) -> void
334
+ } -> void
335
+ | (
336
+ :role_update event_name,
337
+ ?id: Symbol?,
338
+ **untyped metadata
339
+ ) {
340
+ (Discorb::Role before, Discorb::Role after) -> void
341
+ } -> void
342
+ | (
343
+ :role_remove event_name,
344
+ ?id: Symbol?,
345
+ **untyped metadata
346
+ ) {
347
+ (Discorb::Role role) -> void
348
+ } -> void
349
+ | (
350
+ :member_add event_name,
351
+ ?id: Symbol?,
352
+ **untyped metadata
353
+ ) {
354
+ (Discorb::Member member) -> void
355
+ } -> void
356
+ | (
357
+ :member_update event_name,
358
+ ?id: Symbol?,
359
+ **untyped metadata
360
+ ) {
361
+ (Discorb::Member before, Discorb::Member after) -> void
362
+ } -> void
363
+ | (
364
+ :member_remove event_name,
365
+ ?id: Symbol?,
366
+ **untyped metadata
367
+ ) {
368
+ (Discorb::Member member) -> void
369
+ } -> void
370
+ | (
371
+ :role_create event_name,
372
+ ?id: Symbol?,
373
+ **untyped metadata
374
+ ) {
375
+ (Discorb::Role role) -> void
376
+ } -> void
377
+ | (
378
+ :role_update event_name,
379
+ ?id: Symbol?,
380
+ **untyped metadata
381
+ ) {
382
+ (Discorb::Role before, Discorb::Role after) -> void
383
+ } -> void
384
+ | (
385
+ :role_remove event_name,
386
+ ?id: Symbol?,
387
+ **untyped metadata
388
+ ) {
389
+ (Discorb::Role role) -> void
390
+ } -> void
391
+ | (
392
+ :invite_create event_name,
393
+ ?id: Symbol?,
394
+ **untyped metadata
395
+ ) {
396
+ (Discorb::Invite invite) -> void
397
+ } -> void
398
+ | (
399
+ :invite_delete event_name,
400
+ ?id: Symbol?,
401
+ **untyped metadata
402
+ ) {
403
+ (Discorb::Invite invite) -> void
404
+ } -> void
405
+ | (
406
+ :interaction_create event_name,
407
+ ?id: Symbol?,
408
+ **untyped metadata
409
+ ) {
410
+ (Discorb::Interaction interaction) -> void
411
+ } -> void
412
+ | (
413
+ :application_command event_name,
414
+ ?id: Symbol?,
415
+ **untyped metadata
416
+ ) {
417
+ (Discorb::CommandInteraction interaction) -> void
418
+ } -> void
419
+ | (
420
+ :slash_command event_name,
421
+ ?id: Symbol?,
422
+ **untyped metadata
423
+ ) {
424
+ (Discorb::CommandInteraction::ChatInputCommand interaction) -> void
425
+ } -> void
426
+ | (
427
+ :message_command event_name,
428
+ ?id: Symbol?,
429
+ **untyped metadata
430
+ ) {
431
+ (Discorb::CommandInteraction::MessageMenuCommand interaction) -> void
432
+ } -> void
433
+ | (
434
+ :user_command event_name,
435
+ ?id: Symbol?,
436
+ **untyped metadata
437
+ ) {
438
+ (Discorb::CommandInteraction::UserMenuCommand interaction) -> void
439
+ } -> void
440
+ | (
441
+ :button_click event_name,
442
+ ?id: Symbol?,
443
+ **untyped metadata
444
+ ) {
445
+ (Discorb::MessageComponentInteraction::Button interaction) -> void
446
+ } -> void
447
+ | (
448
+ :select_menu_select event_name,
449
+ ?id: Symbol?,
450
+ **untyped metadata
451
+ ) {
452
+ (Discorb::MessageComponentInteraction::SelectMenu interaction) -> void
453
+ } -> void
454
+ | (
455
+ :form_submit event_name,
456
+ ?id: Symbol?,
457
+ **untyped metadata
458
+ ) {
459
+ (Discorb::ModalInteraction interaction) -> void
460
+ } -> void
461
+ | (
462
+ :scheduled_event_create event_name,
463
+ ?id: Symbol?,
464
+ **untyped metadata
465
+ ) {
466
+ (Discorb::ScheduledEvent event) -> void
467
+ } -> void
468
+ | (
469
+ :scheduled_event_cancel event_name,
470
+ ?id: Symbol?,
471
+ **untyped metadata
472
+ ) {
473
+ (Discorb::ScheduledEvent event) -> void
474
+ } -> void
475
+ | (
476
+ :scheduled_event_edit event_name,
477
+ ?id: Symbol?,
478
+ **untyped metadata
479
+ ) {
480
+ (
481
+ Discorb::ScheduledEvent before,
482
+ Discorb::ScheduledEvent after
483
+ ) -> void
484
+ } -> void
485
+ | (
486
+ :scheduled_event_start event_name,
487
+ ?id: Symbol?,
488
+ **untyped metadata
489
+ ) {
490
+ (Discorb::ScheduledEvent event) -> void
491
+ } -> void
492
+ | (
493
+ :scheduled_event_end event_name,
494
+ ?id: Symbol?,
495
+ **untyped metadata
496
+ ) {
497
+ (Discorb::ScheduledEvent event) -> void
498
+ } -> void
499
+ | (
500
+ :auto_moderation_rule_create event_name,
501
+ ?id: Symbol?,
502
+ **untyped metadata
503
+ ) {
504
+ (Discorb::AutoModRule rule) -> void
505
+ } -> void
506
+ | (
507
+ :auto_moderation_rule_update event_name,
508
+ ?id: Symbol?,
509
+ **untyped metadata
510
+ ) {
511
+ (Discorb::AutoModRule rule) -> void
512
+ } -> void
513
+ | (
514
+ :auto_moderation_rule_delete event_name,
515
+ ?id: Symbol?,
516
+ **untyped metadata
517
+ ) {
518
+ (Discorb::AutoModRule rule) -> void
519
+ } -> void
520
+ | (
521
+ :auto_moderation_action_execution event_name,
522
+ ?id: Symbol?,
523
+ **untyped metadata
524
+ ) {
525
+ (Discorb::Gateway::AutoModerationActionExecutionEvent event) -> void
526
+ } -> void
527
+ | (
528
+ :guild_create event_name,
529
+ ?id: Symbol?,
530
+ **untyped metadata
531
+ ) {
532
+ (Discorb::Guild guild) -> void
533
+ } -> void
534
+ | (
535
+ :guild_delete event_name,
536
+ ?id: Symbol?,
537
+ **untyped metadata
538
+ ) {
539
+ (Discorb::Guild guild) -> void
540
+ } -> void
541
+ | (
542
+ :thread_create event_name,
543
+ ?id: Symbol?,
544
+ **untyped metadata
545
+ ) {
546
+ (Discorb::ThreadChannel thread) -> void
547
+ } -> void
548
+ | (
549
+ :scheduled_event_update event_name,
550
+ ?id: Symbol?,
551
+ **untyped metadata
552
+ ) {
553
+ (
554
+ Discorb::ScheduledEvent before,
555
+ Discorb::ScheduledEvent after
556
+ ) -> void
557
+ } -> void
558
+ | (
559
+ :voice_channel_connect event_name,
560
+ ?id: Symbol?,
561
+ **untyped metadata
562
+ ) {
563
+ -> void
564
+ } -> void
565
+ | (
566
+ :voice_channel_disconnect event_name,
567
+ ?id: Symbol?,
568
+ **untyped metadata
569
+ ) {
570
+ -> void
571
+ } -> void
572
+ | (
573
+ :voice_channel_move event_name,
574
+ ?id: Symbol?,
575
+ **untyped metadata
576
+ ) {
577
+ -> void
578
+ } -> void
579
+ | (
580
+ :voice_channel_update event_name,
581
+ ?id: Symbol?,
582
+ **untyped metadata
583
+ ) {
584
+ -> void
585
+ } -> void
586
+ | (
587
+ :voice_mute_disable event_name,
588
+ ?id: Symbol?,
589
+ **untyped metadata
590
+ ) {
591
+ (Discorb::VoiceState state) -> void
592
+ } -> void
593
+ | (
594
+ :voice_mute_enable event_name,
595
+ ?id: Symbol?,
596
+ **untyped metadata
597
+ ) {
598
+ (Discorb::VoiceState state) -> void
599
+ } -> void
600
+ | (
601
+ :voice_mute_update event_name,
602
+ ?id: Symbol?,
603
+ **untyped metadata
604
+ ) {
605
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
606
+ } -> void
607
+ | (
608
+ :voice_server_mute_enable event_name,
609
+ ?id: Symbol?,
610
+ **untyped metadata
611
+ ) {
612
+ (Discorb::VoiceState state) -> void
613
+ } -> void
614
+ | (
615
+ :voice_server_mute_disable event_name,
616
+ ?id: Symbol?,
617
+ **untyped metadata
618
+ ) {
619
+ (Discorb::VoiceState state) -> void
620
+ } -> void
621
+ | (
622
+ :voice_server_mute_update event_name,
623
+ ?id: Symbol?,
624
+ **untyped metadata
625
+ ) {
626
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
627
+ } -> void
628
+ | (
629
+ :voice_self_mute_enable event_name,
630
+ ?id: Symbol?,
631
+ **untyped metadata
632
+ ) {
633
+ (Discorb::VoiceState state) -> void
634
+ } -> void
635
+ | (
636
+ :voice_self_mute_disable event_name,
637
+ ?id: Symbol?,
638
+ **untyped metadata
639
+ ) {
640
+ (Discorb::VoiceState state) -> void
641
+ } -> void
642
+ | (
643
+ :voice_self_mute_update event_name,
644
+ ?id: Symbol?,
645
+ **untyped metadata
646
+ ) {
647
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
648
+ } -> void
649
+ | (
650
+ :voice_deaf_enable event_name,
651
+ ?id: Symbol?,
652
+ **untyped metadata
653
+ ) {
654
+ (Discorb::VoiceState state) -> void
655
+ } -> void
656
+ | (
657
+ :voice_deaf_disable event_name,
658
+ ?id: Symbol?,
659
+ **untyped metadata
660
+ ) {
661
+ (Discorb::VoiceState state) -> void
662
+ } -> void
663
+ | (
664
+ :voice_deaf_update event_name,
665
+ ?id: Symbol?,
666
+ **untyped metadata
667
+ ) {
668
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
669
+ } -> void
670
+ | (
671
+ :voice_server_deaf_enable event_name,
672
+ ?id: Symbol?,
673
+ **untyped metadata
674
+ ) {
675
+ (Discorb::VoiceState state) -> void
676
+ } -> void
677
+ | (
678
+ :voice_server_deaf_disable event_name,
679
+ ?id: Symbol?,
680
+ **untyped metadata
681
+ ) {
682
+ (Discorb::VoiceState state) -> void
683
+ } -> void
684
+ | (
685
+ :voice_server_deaf_update event_name,
686
+ ?id: Symbol?,
687
+ **untyped metadata
688
+ ) {
689
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
690
+ } -> void
691
+ | (
692
+ :voice_self_deaf_enable event_name,
693
+ ?id: Symbol?,
694
+ **untyped metadata
695
+ ) {
696
+ (Discorb::VoiceState state) -> void
697
+ } -> void
698
+ | (
699
+ :voice_self_deaf_disable event_name,
700
+ ?id: Symbol?,
701
+ **untyped metadata
702
+ ) {
703
+ (Discorb::VoiceState state) -> void
704
+ } -> void
705
+ | (
706
+ :voice_self_deaf_update event_name,
707
+ ?id: Symbol?,
708
+ **untyped metadata
709
+ ) {
710
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
711
+ } -> void
712
+ | (
713
+ :voice_stream_start event_name,
714
+ ?id: Symbol?,
715
+ **untyped metadata
716
+ ) {
717
+ (Discorb::VoiceState state) -> void
718
+ } -> void
719
+ | (
720
+ :voice_stream_end event_name,
721
+ ?id: Symbol?,
722
+ **untyped metadata
723
+ ) {
724
+ (Discorb::VoiceState state) -> void
725
+ } -> void
726
+ | (
727
+ :voice_stream_update event_name,
728
+ ?id: Symbol?,
729
+ **untyped metadata
730
+ ) {
731
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
732
+ } -> void
733
+ | (
734
+ :voice_video_start event_name,
735
+ ?id: Symbol?,
736
+ **untyped metadata
737
+ ) {
738
+ (Discorb::VoiceState state) -> void
739
+ } -> void
740
+ | (
741
+ :voice_video_end event_name,
742
+ ?id: Symbol?,
743
+ **untyped metadata
744
+ ) {
745
+ (Discorb::VoiceState state) -> void
746
+ } -> void
747
+ | (
748
+ :voice_video_update event_name,
749
+ ?id: Symbol?,
750
+ **untyped metadata
751
+ ) {
752
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
753
+ } -> void
754
+ | (
755
+ :stage_instance_create event_name,
756
+ ?id: Symbol?,
757
+ **untyped metadata
758
+ ) {
759
+ (Discorb::StageInstance `instance`) -> void
760
+ } -> void
761
+ | (
762
+ :stage_instance_delete event_name,
763
+ ?id: Symbol?,
764
+ **untyped metadata
765
+ ) {
766
+ (Discorb::StageInstance `instance`) -> void
767
+ } -> void
768
+ | (
769
+ :stage_instance_update event_name,
770
+ ?id: Symbol?,
771
+ **untyped metadata
772
+ ) {
773
+ (Discorb::StageInstance before, Discorb::StageInstance after) -> void
774
+ } -> void
775
+ | (
776
+ :voice_state_update event_name,
777
+ ?id: Symbol?,
778
+ **untyped metadata
779
+ ) {
780
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
781
+ } -> void
782
+ | (
783
+ Symbol event_name,
784
+ ?id: Symbol?,
785
+ **untyped metadata
786
+ ) {
787
+ (*untyped) -> void
788
+ } -> void
789
+
790
+ #
791
+ # Define a new once event.
792
+ #
793
+ # @param [Symbol] event_name The name of the event.
794
+ # @param [Symbol] id The id of the event. Used to delete the event.
795
+ # @param [Hash] metadata Other metadata.
796
+ # @param [Proc] block The block to execute when the event is triggered.
797
+ #
798
+ # @return [Discorb::EventHandler] The event.
799
+ def once_event:
800
+ (
801
+ :event_receive event_name,
802
+ ?id: Symbol?,
803
+ **untyped metadata
804
+ ) {
805
+ (Symbol event_name, Discorb::json data) -> void
806
+ } -> void
807
+ | (
808
+ :ready event_name,
809
+ ?id: Symbol?,
810
+ **untyped metadata
811
+ ) {
812
+ -> void
813
+ } -> void
814
+ | (
815
+ :standby event_name,
816
+ ?id: Symbol?,
817
+ **untyped metadata
818
+ ) {
819
+ -> void
820
+ } -> void
821
+ | (
822
+ :resumed event_name,
823
+ ?id: Symbol?,
824
+ **untyped metadata
825
+ ) {
826
+ -> void
827
+ } -> void
828
+ | (
829
+ :error event_name,
830
+ ?id: Symbol?,
831
+ **untyped metadata
832
+ ) {
833
+ (Symbol event_name, Array[Object] args, Exception error) -> void
834
+ } -> void
835
+ | (
836
+ :setup event_name,
837
+ ?id: Symbol?,
838
+ **untyped metadata
839
+ ) {
840
+ -> void
841
+ } -> void
842
+ | (
843
+ :shard_standby event_name,
844
+ ?id: Symbol?,
845
+ **untyped metadata
846
+ ) {
847
+ (Discorb::Shard shard) -> void
848
+ } -> void
849
+ | (
850
+ :shard_resumed event_name,
851
+ ?id: Symbol?,
852
+ **untyped metadata
853
+ ) {
854
+ (Discorb::Shard shard) -> void
855
+ } -> void
856
+ | (
857
+ :guild_join event_name,
858
+ ?id: Symbol?,
859
+ **untyped metadata
860
+ ) {
861
+ (Discorb::Guild guild) -> void
862
+ } -> void
863
+ | (
864
+ :guild_available event_name,
865
+ ?id: Symbol?,
866
+ **untyped metadata
867
+ ) {
868
+ (Discorb::Guild guild) -> void
869
+ } -> void
870
+ | (
871
+ :guild_update event_name,
872
+ ?id: Symbol?,
873
+ **untyped metadata
874
+ ) {
875
+ (Discorb::Guild before, Discorb::Guild after) -> void
876
+ } -> void
877
+ | (
878
+ :guild_leave event_name,
879
+ ?id: Symbol?,
880
+ **untyped metadata
881
+ ) {
882
+ (Discorb::Guild guild) -> void
883
+ } -> void
884
+ | (
885
+ :guild_destroy event_name,
886
+ ?id: Symbol?,
887
+ **untyped metadata
888
+ ) {
889
+ (Discorb::Guild guild) -> void
890
+ } -> void
891
+ | (
892
+ :guild_integrations_update event_name,
893
+ ?id: Symbol?,
894
+ **untyped metadata
895
+ ) {
896
+ (Discorb::Guild guild) -> void
897
+ } -> void
898
+ | (
899
+ :guild_ban_add event_name,
900
+ ?id: Symbol?,
901
+ **untyped metadata
902
+ ) {
903
+ (Discorb::Guild guild, Discorb::User user) -> void
904
+ } -> void
905
+ | (
906
+ :guild_ban_remove event_name,
907
+ ?id: Symbol?,
908
+ **untyped metadata
909
+ ) {
910
+ (Discorb::Guild guild, Discorb::User user) -> void
911
+ } -> void
912
+ | (
913
+ :channel_create event_name,
914
+ ?id: Symbol?,
915
+ **untyped metadata
916
+ ) {
917
+ (Discorb::Channel channel) -> void
918
+ } -> void
919
+ | (
920
+ :channel_update event_name,
921
+ ?id: Symbol?,
922
+ **untyped metadata
923
+ ) {
924
+ (Discorb::Channel before, Discorb::Channel after) -> void
925
+ } -> void
926
+ | (
927
+ :channel_delete event_name,
928
+ ?id: Symbol?,
929
+ **untyped metadata
930
+ ) {
931
+ (Discorb::Channel channel) -> void
932
+ } -> void
933
+ | (
934
+ :webhooks_update event_name,
935
+ ?id: Symbol?,
936
+ **untyped metadata
937
+ ) {
938
+ (Discorb::Gateway::WebhooksUpdateEvent event) -> void
939
+ } -> void
940
+ | (
941
+ :thread_new event_name,
942
+ ?id: Symbol?,
943
+ **untyped metadata
944
+ ) {
945
+ (Discorb::ThreadChannel thread) -> void
946
+ } -> void
947
+ | (
948
+ :thread_join event_name,
949
+ ?id: Symbol?,
950
+ **untyped metadata
951
+ ) {
952
+ (Discorb::ThreadChannel thread) -> void
953
+ } -> void
954
+ | (
955
+ :thread_delete event_name,
956
+ ?id: Symbol?,
957
+ **untyped metadata
958
+ ) {
959
+ (Discorb::ThreadChannel thread) -> void
960
+ } -> void
961
+ | (
962
+ :thread_update event_name,
963
+ ?id: Symbol?,
964
+ **untyped metadata
965
+ ) {
966
+ (Discorb::ThreadChannel before, Discorb::ThreadChannel after) -> void
967
+ } -> void
968
+ | (
969
+ :thread_members_update event_name,
970
+ ?id: Symbol?,
971
+ **untyped metadata
972
+ ) {
973
+ (
974
+ Discorb::ThreadChannel thread,
975
+ Array[Discorb::ThreadChannel::Member] added,
976
+ Array[Discorb::ThreadChannel::Member] removed
977
+ ) -> void
978
+ } -> void
979
+ | (
980
+ :thread_member_update event_name,
981
+ ?id: Symbol?,
982
+ **untyped metadata
983
+ ) {
984
+ (
985
+ Discorb::ThreadChannel thread,
986
+ Discorb::ThreadChannel::Member before,
987
+ Discorb::ThreadChannel::Member after
988
+ ) -> void
989
+ } -> void
990
+ | (
991
+ :integration_create event_name,
992
+ ?id: Symbol?,
993
+ **untyped metadata
994
+ ) {
995
+ (Discorb::Integration integration) -> void
996
+ } -> void
997
+ | (
998
+ :integration_update event_name,
999
+ ?id: Symbol?,
1000
+ **untyped metadata
1001
+ ) {
1002
+ (Discorb::Integration after) -> void
1003
+ } -> void
1004
+ | (
1005
+ :integration_delete event_name,
1006
+ ?id: Symbol?,
1007
+ **untyped metadata
1008
+ ) {
1009
+ (Discorb::Integration integration) -> void
1010
+ } -> void
1011
+ | (
1012
+ :message event_name,
1013
+ ?id: Symbol?,
1014
+ **untyped metadata
1015
+ ) {
1016
+ (Discorb::Message message) -> void
1017
+ } -> void
1018
+ | (
1019
+ :message_update event_name,
1020
+ ?id: Symbol?,
1021
+ **untyped metadata
1022
+ ) {
1023
+ (Discorb::Gateway::MessageUpdateEvent event) -> void
1024
+ } -> void
1025
+ | (
1026
+ :message_delete event_name,
1027
+ ?id: Symbol?,
1028
+ **untyped metadata
1029
+ ) {
1030
+ (
1031
+ Discorb::Message message,
1032
+ Discorb::Channel channel,
1033
+ Discorb::Guild guild
1034
+ ) -> void
1035
+ } -> void
1036
+ | (
1037
+ :message_delete_id event_name,
1038
+ ?id: Symbol?,
1039
+ **untyped metadata
1040
+ ) {
1041
+ (
1042
+ Discorb::Snowflake message_id,
1043
+ Discorb::Channel channel,
1044
+ Discorb::Guild guild
1045
+ ) -> void
1046
+ } -> void
1047
+ | (
1048
+ :message_delete_bulk event_name,
1049
+ ?id: Symbol?,
1050
+ **untyped metadata
1051
+ ) {
1052
+ (
1053
+ Array[Discorb::Message
1054
+ | Discorb::Gateway::UnknownDeleteBulkMessage] messages
1055
+ ) -> void
1056
+ } -> void
1057
+ | (
1058
+ :message_pin_update event_name,
1059
+ ?id: Symbol?,
1060
+ **untyped metadata
1061
+ ) {
1062
+ (Discorb::Gateway::MessagePinEvent event) -> void
1063
+ } -> void
1064
+ | (
1065
+ :typing_start event_name,
1066
+ ?id: Symbol?,
1067
+ **untyped metadata
1068
+ ) {
1069
+ (Discorb::Gateway::TypingStartEvent event) -> void
1070
+ } -> void
1071
+ | (
1072
+ :reaction_add event_name,
1073
+ ?id: Symbol?,
1074
+ **untyped metadata
1075
+ ) {
1076
+ (Discorb::Gateway::ReactionEvent event) -> void
1077
+ } -> void
1078
+ | (
1079
+ :reaction_remove event_name,
1080
+ ?id: Symbol?,
1081
+ **untyped metadata
1082
+ ) {
1083
+ (Discorb::Gateway::ReactionEvent event) -> void
1084
+ } -> void
1085
+ | (
1086
+ :reaction_remove_all event_name,
1087
+ ?id: Symbol?,
1088
+ **untyped metadata
1089
+ ) {
1090
+ (Discorb::Gateway::ReactionRemoveAllEvent event) -> void
1091
+ } -> void
1092
+ | (
1093
+ :reaction_remove_emoji event_name,
1094
+ ?id: Symbol?,
1095
+ **untyped metadata
1096
+ ) {
1097
+ (Discorb::Gateway::ReactionRemoveEmojiEvent event) -> void
1098
+ } -> void
1099
+ | (
1100
+ :role_create event_name,
1101
+ ?id: Symbol?,
1102
+ **untyped metadata
1103
+ ) {
1104
+ (Discorb::Role role) -> void
1105
+ } -> void
1106
+ | (
1107
+ :role_update event_name,
1108
+ ?id: Symbol?,
1109
+ **untyped metadata
1110
+ ) {
1111
+ (Discorb::Role before, Discorb::Role after) -> void
1112
+ } -> void
1113
+ | (
1114
+ :role_remove event_name,
1115
+ ?id: Symbol?,
1116
+ **untyped metadata
1117
+ ) {
1118
+ (Discorb::Role role) -> void
1119
+ } -> void
1120
+ | (
1121
+ :member_add event_name,
1122
+ ?id: Symbol?,
1123
+ **untyped metadata
1124
+ ) {
1125
+ (Discorb::Member member) -> void
1126
+ } -> void
1127
+ | (
1128
+ :member_update event_name,
1129
+ ?id: Symbol?,
1130
+ **untyped metadata
1131
+ ) {
1132
+ (Discorb::Member before, Discorb::Member after) -> void
1133
+ } -> void
1134
+ | (
1135
+ :member_remove event_name,
1136
+ ?id: Symbol?,
1137
+ **untyped metadata
1138
+ ) {
1139
+ (Discorb::Member member) -> void
1140
+ } -> void
1141
+ | (
1142
+ :role_create event_name,
1143
+ ?id: Symbol?,
1144
+ **untyped metadata
1145
+ ) {
1146
+ (Discorb::Role role) -> void
1147
+ } -> void
1148
+ | (
1149
+ :role_update event_name,
1150
+ ?id: Symbol?,
1151
+ **untyped metadata
1152
+ ) {
1153
+ (Discorb::Role before, Discorb::Role after) -> void
1154
+ } -> void
1155
+ | (
1156
+ :role_remove event_name,
1157
+ ?id: Symbol?,
1158
+ **untyped metadata
1159
+ ) {
1160
+ (Discorb::Role role) -> void
1161
+ } -> void
1162
+ | (
1163
+ :invite_create event_name,
1164
+ ?id: Symbol?,
1165
+ **untyped metadata
1166
+ ) {
1167
+ (Discorb::Invite invite) -> void
1168
+ } -> void
1169
+ | (
1170
+ :invite_delete event_name,
1171
+ ?id: Symbol?,
1172
+ **untyped metadata
1173
+ ) {
1174
+ (Discorb::Invite invite) -> void
1175
+ } -> void
1176
+ | (
1177
+ :interaction_create event_name,
1178
+ ?id: Symbol?,
1179
+ **untyped metadata
1180
+ ) {
1181
+ (Discorb::Interaction interaction) -> void
1182
+ } -> void
1183
+ | (
1184
+ :application_command event_name,
1185
+ ?id: Symbol?,
1186
+ **untyped metadata
1187
+ ) {
1188
+ (Discorb::CommandInteraction interaction) -> void
1189
+ } -> void
1190
+ | (
1191
+ :slash_command event_name,
1192
+ ?id: Symbol?,
1193
+ **untyped metadata
1194
+ ) {
1195
+ (Discorb::CommandInteraction::ChatInputCommand interaction) -> void
1196
+ } -> void
1197
+ | (
1198
+ :message_command event_name,
1199
+ ?id: Symbol?,
1200
+ **untyped metadata
1201
+ ) {
1202
+ (Discorb::CommandInteraction::MessageMenuCommand interaction) -> void
1203
+ } -> void
1204
+ | (
1205
+ :user_command event_name,
1206
+ ?id: Symbol?,
1207
+ **untyped metadata
1208
+ ) {
1209
+ (Discorb::CommandInteraction::UserMenuCommand interaction) -> void
1210
+ } -> void
1211
+ | (
1212
+ :button_click event_name,
1213
+ ?id: Symbol?,
1214
+ **untyped metadata
1215
+ ) {
1216
+ (Discorb::MessageComponentInteraction::Button interaction) -> void
1217
+ } -> void
1218
+ | (
1219
+ :select_menu_select event_name,
1220
+ ?id: Symbol?,
1221
+ **untyped metadata
1222
+ ) {
1223
+ (Discorb::MessageComponentInteraction::SelectMenu interaction) -> void
1224
+ } -> void
1225
+ | (
1226
+ :form_submit event_name,
1227
+ ?id: Symbol?,
1228
+ **untyped metadata
1229
+ ) {
1230
+ (Discorb::ModalInteraction interaction) -> void
1231
+ } -> void
1232
+ | (
1233
+ :scheduled_event_create event_name,
1234
+ ?id: Symbol?,
1235
+ **untyped metadata
1236
+ ) {
1237
+ (Discorb::ScheduledEvent event) -> void
1238
+ } -> void
1239
+ | (
1240
+ :scheduled_event_cancel event_name,
1241
+ ?id: Symbol?,
1242
+ **untyped metadata
1243
+ ) {
1244
+ (Discorb::ScheduledEvent event) -> void
1245
+ } -> void
1246
+ | (
1247
+ :scheduled_event_edit event_name,
1248
+ ?id: Symbol?,
1249
+ **untyped metadata
1250
+ ) {
1251
+ (
1252
+ Discorb::ScheduledEvent before,
1253
+ Discorb::ScheduledEvent after
1254
+ ) -> void
1255
+ } -> void
1256
+ | (
1257
+ :scheduled_event_start event_name,
1258
+ ?id: Symbol?,
1259
+ **untyped metadata
1260
+ ) {
1261
+ (Discorb::ScheduledEvent event) -> void
1262
+ } -> void
1263
+ | (
1264
+ :scheduled_event_end event_name,
1265
+ ?id: Symbol?,
1266
+ **untyped metadata
1267
+ ) {
1268
+ (Discorb::ScheduledEvent event) -> void
1269
+ } -> void
1270
+ | (
1271
+ :auto_moderation_rule_create event_name,
1272
+ ?id: Symbol?,
1273
+ **untyped metadata
1274
+ ) {
1275
+ (Discorb::AutoModRule rule) -> void
1276
+ } -> void
1277
+ | (
1278
+ :auto_moderation_rule_update event_name,
1279
+ ?id: Symbol?,
1280
+ **untyped metadata
1281
+ ) {
1282
+ (Discorb::AutoModRule rule) -> void
1283
+ } -> void
1284
+ | (
1285
+ :auto_moderation_rule_delete event_name,
1286
+ ?id: Symbol?,
1287
+ **untyped metadata
1288
+ ) {
1289
+ (Discorb::AutoModRule rule) -> void
1290
+ } -> void
1291
+ | (
1292
+ :auto_moderation_action_execution event_name,
1293
+ ?id: Symbol?,
1294
+ **untyped metadata
1295
+ ) {
1296
+ (Discorb::Gateway::AutoModerationActionExecutionEvent event) -> void
1297
+ } -> void
1298
+ | (
1299
+ :guild_create event_name,
1300
+ ?id: Symbol?,
1301
+ **untyped metadata
1302
+ ) {
1303
+ (Discorb::Guild guild) -> void
1304
+ } -> void
1305
+ | (
1306
+ :guild_delete event_name,
1307
+ ?id: Symbol?,
1308
+ **untyped metadata
1309
+ ) {
1310
+ (Discorb::Guild guild) -> void
1311
+ } -> void
1312
+ | (
1313
+ :thread_create event_name,
1314
+ ?id: Symbol?,
1315
+ **untyped metadata
1316
+ ) {
1317
+ (Discorb::ThreadChannel thread) -> void
1318
+ } -> void
1319
+ | (
1320
+ :scheduled_event_update event_name,
1321
+ ?id: Symbol?,
1322
+ **untyped metadata
1323
+ ) {
1324
+ (
1325
+ Discorb::ScheduledEvent before,
1326
+ Discorb::ScheduledEvent after
1327
+ ) -> void
1328
+ } -> void
1329
+ | (
1330
+ :voice_channel_connect event_name,
1331
+ ?id: Symbol?,
1332
+ **untyped metadata
1333
+ ) {
1334
+ -> void
1335
+ } -> void
1336
+ | (
1337
+ :voice_channel_disconnect event_name,
1338
+ ?id: Symbol?,
1339
+ **untyped metadata
1340
+ ) {
1341
+ -> void
1342
+ } -> void
1343
+ | (
1344
+ :voice_channel_move event_name,
1345
+ ?id: Symbol?,
1346
+ **untyped metadata
1347
+ ) {
1348
+ -> void
1349
+ } -> void
1350
+ | (
1351
+ :voice_channel_update event_name,
1352
+ ?id: Symbol?,
1353
+ **untyped metadata
1354
+ ) {
1355
+ -> void
1356
+ } -> void
1357
+ | (
1358
+ :voice_mute_disable event_name,
1359
+ ?id: Symbol?,
1360
+ **untyped metadata
1361
+ ) {
1362
+ (Discorb::VoiceState state) -> void
1363
+ } -> void
1364
+ | (
1365
+ :voice_mute_enable event_name,
1366
+ ?id: Symbol?,
1367
+ **untyped metadata
1368
+ ) {
1369
+ (Discorb::VoiceState state) -> void
1370
+ } -> void
1371
+ | (
1372
+ :voice_mute_update event_name,
1373
+ ?id: Symbol?,
1374
+ **untyped metadata
1375
+ ) {
1376
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
1377
+ } -> void
1378
+ | (
1379
+ :voice_server_mute_enable event_name,
1380
+ ?id: Symbol?,
1381
+ **untyped metadata
1382
+ ) {
1383
+ (Discorb::VoiceState state) -> void
1384
+ } -> void
1385
+ | (
1386
+ :voice_server_mute_disable event_name,
1387
+ ?id: Symbol?,
1388
+ **untyped metadata
1389
+ ) {
1390
+ (Discorb::VoiceState state) -> void
1391
+ } -> void
1392
+ | (
1393
+ :voice_server_mute_update event_name,
1394
+ ?id: Symbol?,
1395
+ **untyped metadata
1396
+ ) {
1397
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
1398
+ } -> void
1399
+ | (
1400
+ :voice_self_mute_enable event_name,
1401
+ ?id: Symbol?,
1402
+ **untyped metadata
1403
+ ) {
1404
+ (Discorb::VoiceState state) -> void
1405
+ } -> void
1406
+ | (
1407
+ :voice_self_mute_disable event_name,
1408
+ ?id: Symbol?,
1409
+ **untyped metadata
1410
+ ) {
1411
+ (Discorb::VoiceState state) -> void
1412
+ } -> void
1413
+ | (
1414
+ :voice_self_mute_update event_name,
1415
+ ?id: Symbol?,
1416
+ **untyped metadata
1417
+ ) {
1418
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
1419
+ } -> void
1420
+ | (
1421
+ :voice_deaf_enable event_name,
1422
+ ?id: Symbol?,
1423
+ **untyped metadata
1424
+ ) {
1425
+ (Discorb::VoiceState state) -> void
1426
+ } -> void
1427
+ | (
1428
+ :voice_deaf_disable event_name,
1429
+ ?id: Symbol?,
1430
+ **untyped metadata
1431
+ ) {
1432
+ (Discorb::VoiceState state) -> void
1433
+ } -> void
1434
+ | (
1435
+ :voice_deaf_update event_name,
1436
+ ?id: Symbol?,
1437
+ **untyped metadata
1438
+ ) {
1439
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
1440
+ } -> void
1441
+ | (
1442
+ :voice_server_deaf_enable event_name,
1443
+ ?id: Symbol?,
1444
+ **untyped metadata
1445
+ ) {
1446
+ (Discorb::VoiceState state) -> void
1447
+ } -> void
1448
+ | (
1449
+ :voice_server_deaf_disable event_name,
1450
+ ?id: Symbol?,
1451
+ **untyped metadata
1452
+ ) {
1453
+ (Discorb::VoiceState state) -> void
1454
+ } -> void
1455
+ | (
1456
+ :voice_server_deaf_update event_name,
1457
+ ?id: Symbol?,
1458
+ **untyped metadata
1459
+ ) {
1460
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
1461
+ } -> void
1462
+ | (
1463
+ :voice_self_deaf_enable event_name,
1464
+ ?id: Symbol?,
1465
+ **untyped metadata
1466
+ ) {
1467
+ (Discorb::VoiceState state) -> void
1468
+ } -> void
1469
+ | (
1470
+ :voice_self_deaf_disable event_name,
1471
+ ?id: Symbol?,
1472
+ **untyped metadata
1473
+ ) {
1474
+ (Discorb::VoiceState state) -> void
1475
+ } -> void
1476
+ | (
1477
+ :voice_self_deaf_update event_name,
1478
+ ?id: Symbol?,
1479
+ **untyped metadata
1480
+ ) {
1481
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
1482
+ } -> void
1483
+ | (
1484
+ :voice_stream_start event_name,
1485
+ ?id: Symbol?,
1486
+ **untyped metadata
1487
+ ) {
1488
+ (Discorb::VoiceState state) -> void
1489
+ } -> void
1490
+ | (
1491
+ :voice_stream_end event_name,
1492
+ ?id: Symbol?,
1493
+ **untyped metadata
1494
+ ) {
1495
+ (Discorb::VoiceState state) -> void
1496
+ } -> void
1497
+ | (
1498
+ :voice_stream_update event_name,
1499
+ ?id: Symbol?,
1500
+ **untyped metadata
1501
+ ) {
1502
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
1503
+ } -> void
1504
+ | (
1505
+ :voice_video_start event_name,
1506
+ ?id: Symbol?,
1507
+ **untyped metadata
1508
+ ) {
1509
+ (Discorb::VoiceState state) -> void
1510
+ } -> void
1511
+ | (
1512
+ :voice_video_end event_name,
1513
+ ?id: Symbol?,
1514
+ **untyped metadata
1515
+ ) {
1516
+ (Discorb::VoiceState state) -> void
1517
+ } -> void
1518
+ | (
1519
+ :voice_video_update event_name,
1520
+ ?id: Symbol?,
1521
+ **untyped metadata
1522
+ ) {
1523
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
1524
+ } -> void
1525
+ | (
1526
+ :stage_instance_create event_name,
1527
+ ?id: Symbol?,
1528
+ **untyped metadata
1529
+ ) {
1530
+ (Discorb::StageInstance `instance`) -> void
1531
+ } -> void
1532
+ | (
1533
+ :stage_instance_delete event_name,
1534
+ ?id: Symbol?,
1535
+ **untyped metadata
1536
+ ) {
1537
+ (Discorb::StageInstance `instance`) -> void
1538
+ } -> void
1539
+ | (
1540
+ :stage_instance_update event_name,
1541
+ ?id: Symbol?,
1542
+ **untyped metadata
1543
+ ) {
1544
+ (Discorb::StageInstance before, Discorb::StageInstance after) -> void
1545
+ } -> void
1546
+ | (
1547
+ :voice_state_update event_name,
1548
+ ?id: Symbol?,
1549
+ **untyped metadata
1550
+ ) {
1551
+ (Discorb::VoiceState before, Discorb::VoiceState after) -> void
1552
+ } -> void
1553
+ | (
1554
+ Symbol event_name,
1555
+ ?id: Symbol?,
1556
+ **untyped metadata
1557
+ ) {
1558
+ (*untyped) -> void
1559
+ } -> void
1560
+
1561
+ def self.extended: (untyped klass) -> untyped
1562
+
1563
+ #
1564
+ # Add new top-level command.
1565
+ #
1566
+ # @param [String, Hash{Symbol => String}] command_name Command name.
1567
+ # If hash is passed, it must be a pair of Language code and Command name, and `:default` key is required.
1568
+ # You can use `_` instead of `-` in language code.
1569
+ # @param [String, Hash{Symbol => String}] description Command description.
1570
+ # If hash is passed, it must be a pair of Language code and Command description, and `:default` key is required.
1571
+ # You can use `_` instead of `-` in language code.
1572
+ # @param [Hash{String => Hash{:description => String, :optional => Boolean, :type => Object}}] options
1573
+ # Command options.
1574
+ # The key is the option name, the value is a hash with the following keys:
1575
+ #
1576
+ # | Key | Type | Description |
1577
+ # | --- | --- | --- |
1578
+ # | `:name_localizations` | Hash{Symbol => String} | Localizations of option name. |
1579
+ # | `:description` | `String` \| `Hash{Symbol => String}` |
1580
+ # Description of the option. If hash is passed, it must be a pair of Language code and description,
1581
+ # and `:default` key is required. You can use `_` instead of `-` in language code. |
1582
+ # | `:required` | Boolean(true | false) |
1583
+ # Whether the argument is required. `optional` will be used if not specified. |
1584
+ # | `:optional` | Boolean(true | false) |
1585
+ # Whether the argument is optional. `required` will be used if not specified. |
1586
+ # | `:type` | `Object` | Type of the option. |
1587
+ # | `:choices` | `Hash{String => String, Integer, Float}` | Type of the option. |
1588
+ # | `:choices_localizations` | `Hash{String => Hash{Symbol => String}}` |
1589
+ # Localization of the choice. Key must be the name of a choice. |
1590
+ # | `:default` | `Object` | Default value of the option. |
1591
+ # | `:channel_types` | `Array<Class<Discorb::Channel>>` | Type of the channel option. |
1592
+ # | `:autocomplete` | `Proc` | Autocomplete function. |
1593
+ # | `:range` | `Range` | Range of the option. Only valid for numeric options. (`:int`, `:float`) |
1594
+ #
1595
+ # @param [Array<#to_s>, false, nil] guild_ids
1596
+ # Guild IDs to set the command to. `false` to global command, `nil` to use default.
1597
+ # @param [Boolean] dm_permission Whether the command is available in DM.
1598
+ # @param [Discorb::Permission] default_permission The default permission of the command.
1599
+ # @param [Proc] block Command block.
1600
+ #
1601
+ # @return [Discorb::ApplicationCommand::Command::ChatInputCommand] Command object.
1602
+ #
1603
+ # @see file:docs/application_command.md#register-slash-command Application Comamnds: Register Slash Command
1604
+ # @see file:docs/cli/setup.md CLI: setup
1605
+ def slash: (
1606
+ String | ::Hash[Symbol, String] command_name,
1607
+ String | ::Hash[Symbol, String] description,
1608
+ ?::Hash[String, String | Integer | Float] options,
1609
+ ?guild_ids: (::Array[untyped] | bool)?,
1610
+ ?dm_permission: bool,
1611
+ ?default_permission: Discorb::Permission?
1612
+ ) -> Discorb::ApplicationCommand::Command::ChatInputCommand
1613
+
1614
+ #
1615
+ # Add new command with group.
1616
+ #
1617
+ # @param [String, Hash{Symbol => String}] command_name Command name.
1618
+ # @param [String, Hash{Symbol => String}] description Command description.
1619
+ # @param [Array<#to_s>, false, nil] guild_ids
1620
+ # Guild IDs to set the command to. `false` to global command, `nil` to use default.
1621
+ # @param [Boolean] dm_permission Whether the command is available in DM.
1622
+ # @param [Discorb::Permission] default_permission The default permission of the command.
1623
+ #
1624
+ # @yield Block to yield with the command.
1625
+ # @yieldparam [Discorb::ApplicationCommand::Command::GroupCommand] group Group command.
1626
+ #
1627
+ # @return [Discorb::ApplicationCommand::Command::GroupCommand] Command object.
1628
+ #
1629
+ # @see file:docs/application_command.md Application Commands
1630
+ # @see file:docs/cli/setup.md CLI: setup
1631
+ def slash_group: (
1632
+ String | ::Hash[Symbol, String] command_name,
1633
+ String | ::Hash[Symbol, String] description,
1634
+ ?guild_ids: (::Array[untyped] | bool)?,
1635
+ ?dm_permission: bool,
1636
+ ?default_permission: Discorb::Permission?
1637
+ ) ?{
1638
+ (Discorb::ApplicationCommand::Command::GroupCommand group) -> void
1639
+ } -> Discorb::ApplicationCommand::Command::GroupCommand
1640
+
1641
+ #
1642
+ # Add message context menu command.
1643
+ #
1644
+ # @param [String, Hash{Symbol => String}] command_name Command name.
1645
+ # @param [Array<#to_s>, false, nil] guild_ids
1646
+ # Guild IDs to set the command to. `false` to global command, `nil` to use default.
1647
+ # @param [Boolean] dm_permission Whether the command is available in DM.
1648
+ # @param [Discorb::Permission] default_permission The default permission of the command.
1649
+ # @param [Proc] block Command block.
1650
+ # @yield [interaction, message] Block to execute.
1651
+ # @yieldparam [Discorb::CommandInteraction::UserMenuCommand] interaction Interaction object.
1652
+ # @yieldparam [Discorb::Message] message Message object.
1653
+ #
1654
+ # @return [Discorb::ApplicationCommand::Command] Command object.
1655
+ def message_command: (
1656
+ String | ::Hash[Symbol, String] command_name,
1657
+ ?guild_ids: (::Array[untyped] | bool)?,
1658
+ ?dm_permission: bool,
1659
+ ?default_permission: Discorb::Permission?
1660
+ ) ?{
1661
+ (
1662
+ Discorb::CommandInteraction::UserMenuCommand interaction,
1663
+ Discorb::Message message
1664
+ ) -> void
1665
+ } -> Discorb::ApplicationCommand::Command
1666
+
1667
+ #
1668
+ # Add user context menu command.
1669
+ #
1670
+ # @param [String, Hash{Symbol => String}] command_name Command name.
1671
+ # @param [Array<#to_s>, false, nil] guild_ids
1672
+ # Guild IDs to set the command to. `false` to global command, `nil` to use default.
1673
+ # @param [Boolean] dm_permission Whether the command is available in DM.
1674
+ # @param [Discorb::Permission] default_permission The default permission of the command.
1675
+ # @param [Proc] block Command block.
1676
+ # @yield [interaction, user] Block to execute.
1677
+ # @yieldparam [Discorb::CommandInteraction::UserMenuCommand] interaction Interaction object.
1678
+ # @yieldparam [Discorb::User] user User object.
1679
+ #
1680
+ # @return [Discorb::ApplicationCommand::Command] Command object.
1681
+ def user_command: (
1682
+ String | ::Hash[Symbol, String] command_name,
1683
+ ?guild_ids: (::Array[untyped] | bool)?,
1684
+ ?dm_permission: bool,
1685
+ ?default_permission: Discorb::Permission?
1686
+ ) ?{
1687
+ (
1688
+ Discorb::CommandInteraction::UserMenuCommand interaction,
1689
+ Discorb::User user
1690
+ ) -> void
1691
+ } -> Discorb::ApplicationCommand::Command
1692
+
1693
+ #
1694
+ # Setup commands.
1695
+ # @async
1696
+ # @see Client#initialize
1697
+ #
1698
+ # @param [String] token Bot token.
1699
+ # @param [Array<#to_s>, false, nil] guild_ids
1700
+ # Guild IDs to use as default. If `false` is given, it will be global command.
1701
+ #
1702
+ # @note `token` parameter only required if you don't run client.
1703
+ def setup_commands: (
1704
+ ?String? token,
1705
+ ?guild_ids: (::Array[untyped] | bool)?
1706
+ ) -> untyped
1707
+
1708
+ #
1709
+ # Claer commands in specified guilds.
1710
+ # @async
1711
+ # @see Client#initialize
1712
+ #
1713
+ # @param [String] token Bot token.
1714
+ # @param [Array<#to_s>, false, nil] guild_ids Guild IDs to clear.
1715
+ #
1716
+ # @note `token` parameter only required if you don't run client.
1717
+ def clear_commands: (
1718
+ String token,
1719
+ (::Array[untyped] | bool)? guild_ids
1720
+ ) -> untyped
1721
+
1722
+ # @return [Hash{Symbol => Array<Discorb::EventHandler>}] The events of the extension.
1723
+ attr_reader events: ::Hash[Symbol, [Symbol?, Hash[untyped, untyped], ^(
1724
+ *untyped
1725
+ ) -> void]]
1726
+
1727
+ # @return [Array<Discorb::ApplicationCommand::Command>] The commands of the extension.
1728
+ attr_reader commands: ::Array[Discorb::ApplicationCommand::Command]
1729
+
1730
+ # @private
1731
+ attr_reader callable_commands: untyped
1732
+ end
1733
+ end
1734
+ end