discorb 0.17.1 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/lint.yml +1 -3
  3. data/.github/workflows/validate.yml +21 -0
  4. data/Changelog.md +25 -0
  5. data/Gemfile +6 -0
  6. data/README.md +2 -1
  7. data/Rakefile +205 -98
  8. data/Steepfile +30 -0
  9. data/docs/application_command.md +1 -0
  10. data/docs/events.md +44 -8
  11. data/docs/tutorial.md +7 -7
  12. data/docs/voice_events.md +8 -8
  13. data/examples/commands/message.rb +12 -7
  14. data/examples/commands/permission.rb +2 -1
  15. data/examples/commands/slash.rb +23 -19
  16. data/examples/commands/user.rb +15 -12
  17. data/examples/components/authorization_button.rb +2 -1
  18. data/examples/components/select_menu.rb +4 -1
  19. data/examples/extension/main.rb +1 -0
  20. data/examples/extension/message_expander.rb +1 -0
  21. data/examples/sig/commands/message.rbs +5 -0
  22. data/examples/simple/eval.rb +1 -0
  23. data/examples/simple/ping_pong.rb +1 -0
  24. data/examples/simple/rolepanel.rb +16 -5
  25. data/examples/simple/shard.rb +2 -1
  26. data/examples/simple/wait_for_message.rb +3 -0
  27. data/exe/discorb +3 -3
  28. data/lib/discorb/allowed_mentions.rb +1 -1
  29. data/lib/discorb/app_command/command.rb +16 -13
  30. data/lib/discorb/app_command/handler.rb +21 -6
  31. data/lib/discorb/audit_logs.rb +6 -2
  32. data/lib/discorb/automod.rb +269 -0
  33. data/lib/discorb/channel/guild.rb +5 -4
  34. data/lib/discorb/channel/stage.rb +1 -1
  35. data/lib/discorb/channel/text.rb +14 -23
  36. data/lib/discorb/channel/thread.rb +15 -11
  37. data/lib/discorb/client.rb +15 -15
  38. data/lib/discorb/color.rb +37 -60
  39. data/lib/discorb/common.rb +1 -1
  40. data/lib/discorb/dictionary.rb +1 -1
  41. data/lib/discorb/embed.rb +5 -4
  42. data/lib/discorb/emoji.rb +4 -4
  43. data/lib/discorb/event.rb +2 -2
  44. data/lib/discorb/exe/about.rb +1 -1
  45. data/lib/discorb/exe/new.rb +1 -5
  46. data/lib/discorb/extension.rb +0 -4
  47. data/lib/discorb/flag.rb +2 -2
  48. data/lib/discorb/gateway.rb +38 -589
  49. data/lib/discorb/gateway_events.rb +638 -0
  50. data/lib/discorb/guild.rb +138 -19
  51. data/lib/discorb/guild_template.rb +3 -3
  52. data/lib/discorb/http.rb +47 -25
  53. data/lib/discorb/integration.rb +2 -2
  54. data/lib/discorb/intents.rb +27 -18
  55. data/lib/discorb/interaction/command.rb +14 -10
  56. data/lib/discorb/interaction/response.rb +150 -84
  57. data/lib/discorb/interaction/root.rb +139 -0
  58. data/lib/discorb/invite.rb +1 -1
  59. data/lib/discorb/member.rb +3 -3
  60. data/lib/discorb/message.rb +17 -15
  61. data/lib/discorb/message_meta.rb +2 -3
  62. data/lib/discorb/modules.rb +5 -4
  63. data/lib/discorb/permission.rb +3 -1
  64. data/lib/discorb/presence.rb +4 -2
  65. data/lib/discorb/reaction.rb +2 -2
  66. data/lib/discorb/role.rb +3 -3
  67. data/lib/discorb/shard.rb +1 -1
  68. data/lib/discorb/sticker.rb +5 -5
  69. data/lib/discorb/user.rb +2 -2
  70. data/lib/discorb/voice_state.rb +8 -8
  71. data/lib/discorb/webhook.rb +20 -11
  72. data/lib/discorb.rb +2 -2
  73. data/rbs_collection.lock.yaml +88 -96
  74. data/rbs_collection.yaml +21 -17
  75. data/sig/async.rbs +11 -5
  76. data/sig/discorb/activity.rbs +24 -0
  77. data/sig/discorb/allowed_mentions.rbs +45 -0
  78. data/sig/discorb/app_command/base.rbs +288 -0
  79. data/sig/discorb/app_command/handler.rbs +171 -0
  80. data/sig/discorb/application.rbs +146 -0
  81. data/sig/discorb/asset.rbs +34 -0
  82. data/sig/discorb/attachment.rbs +99 -0
  83. data/sig/discorb/audit_log.rbs +238 -0
  84. data/sig/discorb/automod.rbs +145 -0
  85. data/sig/discorb/avatar.rbs +27 -0
  86. data/sig/discorb/channel/base.rbs +186 -0
  87. data/sig/discorb/channel/category.rbs +57 -0
  88. data/sig/discorb/channel/container.rbs +33 -0
  89. data/sig/discorb/channel/dm.rbs +14 -0
  90. data/sig/discorb/channel/news.rbs +20 -0
  91. data/sig/discorb/channel/stage.rbs +81 -0
  92. data/sig/discorb/channel/text.rbs +158 -0
  93. data/sig/discorb/channel/thread.rbs +196 -0
  94. data/sig/discorb/channel/voice.rbs +43 -0
  95. data/sig/discorb/client.rbs +2496 -0
  96. data/sig/discorb/color.rbs +148 -0
  97. data/sig/discorb/component/base.rbs +29 -0
  98. data/sig/discorb/component/button.rbs +67 -0
  99. data/sig/discorb/component/select_menu.rbs +111 -0
  100. data/sig/discorb/component/text_input.rbs +70 -0
  101. data/sig/discorb/connectable.rbs +8 -0
  102. data/sig/discorb/custom_emoji.rbs +94 -0
  103. data/sig/discorb/dictionary.rbs +87 -0
  104. data/sig/discorb/discord_model.rbs +17 -0
  105. data/sig/discorb/embed.rbs +286 -0
  106. data/sig/discorb/emoji.rbs +14 -0
  107. data/sig/discorb/error.rbs +73 -0
  108. data/sig/discorb/event_handler.rbs +28 -0
  109. data/sig/discorb/extension.rbs +1735 -0
  110. data/sig/discorb/flag.rbs +74 -0
  111. data/sig/discorb/gateway.rbs +486 -0
  112. data/sig/discorb/guild.rbs +872 -0
  113. data/sig/discorb/guild_template.rbs +174 -0
  114. data/sig/discorb/http.rbs +150 -0
  115. data/sig/discorb/image.rbs +22 -0
  116. data/sig/discorb/integration.rbs +118 -0
  117. data/sig/discorb/intents.rbs +98 -0
  118. data/sig/discorb/interaction/autocomplete.rbs +9 -0
  119. data/sig/discorb/interaction/base.rbs +102 -0
  120. data/sig/discorb/interaction/command.rbs +66 -0
  121. data/sig/discorb/interaction/message_component.rbs +139 -0
  122. data/sig/discorb/interaction/modal.rbs +49 -0
  123. data/sig/discorb/interaction/responder.rbs +157 -0
  124. data/sig/discorb/invite.rbs +86 -0
  125. data/sig/discorb/member.rbs +189 -0
  126. data/sig/discorb/message.rbs +474 -0
  127. data/sig/discorb/messageable.rbs +150 -0
  128. data/sig/discorb/partial_emoji.rbs +38 -0
  129. data/sig/discorb/permissions.rbs +156 -0
  130. data/sig/discorb/presence.rbs +239 -0
  131. data/sig/discorb/reaction.rbs +37 -0
  132. data/sig/discorb/role.rbs +151 -0
  133. data/sig/discorb/scheduled_event.rbs +149 -0
  134. data/sig/discorb/shard.rbs +63 -0
  135. data/sig/discorb/snowflake.rbs +58 -0
  136. data/sig/discorb/stage_instance.rbs +69 -0
  137. data/sig/discorb/sticker.rbs +116 -0
  138. data/sig/discorb/system_channel_flag.rbs +17 -0
  139. data/sig/discorb/unicode_emoji.rbs +53 -0
  140. data/sig/discorb/user.rbs +95 -0
  141. data/sig/discorb/utils.rbs +8 -0
  142. data/sig/discorb/voice_region.rbs +30 -0
  143. data/sig/discorb/voice_state.rbs +71 -0
  144. data/sig/discorb/webhook.rbs +338 -0
  145. data/sig/discorb/welcome_screen.rbs +79 -0
  146. data/sig/discorb.rbs +5 -8661
  147. data/sig/manifest.yaml +3 -0
  148. data/sig/override.rbs +21 -0
  149. metadata +80 -3
@@ -0,0 +1,74 @@
1
+ module Discorb
2
+ #
3
+ # Represents a flag.
4
+ # @abstract
5
+ class Flag
6
+ # Initialize the flag.
7
+ # @note This is usually called by the subclass.
8
+ #
9
+ # @param [Integer] value The value of the flag.
10
+ def initialize: (Integer value) -> void
11
+
12
+ #
13
+ # Union of two flags.
14
+ #
15
+ # @param [Discorb::Flag] other The other flag.
16
+ #
17
+ # @return [Discorb::Flag] The union of the two flags.
18
+ def |: (instance other) -> instance
19
+
20
+ #
21
+ # Subtraction of two flags.
22
+ #
23
+ # @param [Discorb::Flag] other The other flag.
24
+ #
25
+ # @return [Discorb::Flag] The subtraction of the two flags.
26
+ def -: (instance other) -> instance
27
+
28
+ #
29
+ # Intersection of two flags.
30
+ #
31
+ # @param [Discorb::Flag] other The other flag.
32
+ #
33
+ # @return [Discorb::Flag] The intersection of the two flags.
34
+ def &: (instance other) -> instance
35
+
36
+ #
37
+ # XOR of two flags.
38
+ #
39
+ # @param [Discorb::Flag] other The other flag.
40
+ #
41
+ # @return [Discorb::Flag] The XOR of the two flags.
42
+ def ^: (instance other) -> instance
43
+
44
+ #
45
+ # Negation of the flag.
46
+ #
47
+ # @return [Discorb::Flag] The negation of the flag.
48
+ def ~: -> instance
49
+
50
+ %a{pure}
51
+ def to_i: -> Integer
52
+
53
+ %a{pure}
54
+ def inspect: -> String
55
+
56
+ #
57
+ # Max value of the flag.
58
+ #
59
+ # @return [Integer] the max value of the flag.
60
+ def self.max_value: -> (Integer | Numeric)
61
+
62
+ #
63
+ # Initialize a new flag with keys.
64
+ def self.from_keys: (*Symbol keys) -> untyped
65
+
66
+ attr_reader self.bits: Hash[Symbol, Integer]
67
+
68
+ # @return [Hash{Symbol => Boolean}] the values of the flag.
69
+ attr_reader values: ::Hash[Symbol, bool]
70
+
71
+ # @return [Integer] the value of the flag.
72
+ attr_reader value: Integer
73
+ end
74
+ end
@@ -0,0 +1,486 @@
1
+ module Discorb
2
+ #
3
+ # A module for Discord Gateway.
4
+ # This module is internal use only.
5
+ module Gateway
6
+ #
7
+ # Represents an event.
8
+ # @abstract
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
+ def initialize: (Discorb::json data) -> void
16
+
17
+ %a{pure}
18
+ def inspect: -> String
19
+ end
20
+
21
+ #
22
+ # Represents a reaction event.
23
+ class ReactionEvent < Discorb::Gateway::GatewayEvent
24
+ #
25
+ # Initializes a new instance of the ReactionEvent class.
26
+ # @private
27
+ #
28
+ # @param [Discorb::Client] client The client that instantiated the object.
29
+ # @param [Hash] data The data of the event.
30
+ def initialize: (Discorb::Client client, Discorb::json data) -> void
31
+
32
+ # Fetch the message.
33
+ # If message is cached, it will be returned.
34
+ # @async
35
+ #
36
+ # @param [Boolean] force Whether to force fetching the message.
37
+ #
38
+ # @return [Async::Task<Discorb::Message>] The message.
39
+ def fetch_message: (?force: bool) -> Async::Task[Discorb::Message]
40
+
41
+ # @return [Hash] The raw data of the event.
42
+ attr_reader data: Discorb::json
43
+
44
+ # @return [Discorb::Snowflake] The ID of the user who reacted.
45
+ attr_reader user_id: Discorb::Snowflake
46
+
47
+ # @return [Discorb::Snowflake] The ID of the channel the message was sent in.
48
+ attr_reader channel_id: Discorb::Snowflake
49
+
50
+ # @return [Discorb::Snowflake] The ID of the message.
51
+ attr_reader message_id: Discorb::Snowflake
52
+
53
+ # @return [Discorb::Snowflake] The ID of the guild the message was sent in.
54
+ attr_reader guild_id: Discorb::Snowflake
55
+
56
+ # @macro client_cache
57
+ # @return [Discorb::Channel] The channel the message was sent in.
58
+ attr_reader channel: Discorb::Channel?
59
+
60
+ # @macro client_cache
61
+ # @return [Discorb::Guild] The guild the message was sent in.
62
+ attr_reader guild: Discorb::Guild?
63
+
64
+ # @macro client_cache
65
+ # @return [Discorb::Message] The message the reaction was sent in.
66
+ attr_reader message: Discorb::Message?
67
+
68
+ # @return [Discorb::UnicodeEmoji, Discorb::PartialEmoji] The emoji that was reacted with.
69
+ attr_reader emoji: Discorb::UnicodeEmoji | Discorb::PartialEmoji
70
+
71
+ # @macro client_cache
72
+ # @return [Discorb::User, Discorb::Member] The user that is typing.
73
+ attr_reader user: Discorb::Member | Discorb::User
74
+ alias member user
75
+ end
76
+
77
+ #
78
+ # Represents a `INTEGRATION_DELETE` event.
79
+ class IntegrationDeleteEvent < Discorb::Gateway::GatewayEvent
80
+ #
81
+ # Initialize a new instance of the IntegrationDeleteEvent class.
82
+ # @private
83
+ #
84
+ #
85
+ # @param [Hash] data The data of the event.
86
+ def initialize: (untyped _client, Discorb::json data) -> void
87
+
88
+ # @return [Discorb::Snowflake] The ID of the integration.
89
+ attr_reader id: Discorb::Snowflake
90
+
91
+ # @macro client_cache
92
+ # @return [Discorb::Guild] The guild of the integration.
93
+ attr_reader guild: Discorb::Guild?
94
+
95
+ # @macro client_cache
96
+ # @return [Discorb::User] The user associated with the integration.
97
+ attr_reader user: Discorb::User?
98
+ end
99
+
100
+ #
101
+ # Represents a `MESSAGE_REACTION_REMOVE_ALL` event.
102
+ class ReactionRemoveAllEvent < Discorb::Gateway::GatewayEvent
103
+ #
104
+ # Initialize a new instance of the ReactionRemoveAllEvent class.
105
+ # @private
106
+ #
107
+ # @param [Discorb::Client] client The client that instantiated the object.
108
+ # @param [Hash] data The data of the event.
109
+ def initialize: (Discorb::Client client, Discorb::json data) -> void
110
+
111
+ # Fetch the message.
112
+ # If message is cached, it will be returned.
113
+ # @async
114
+ #
115
+ # @param [Boolean] force Whether to force fetching the message.
116
+ #
117
+ # @return [Async::Task<Discorb::Message>] The message.
118
+ def fetch_message: (?force: bool) -> Async::Task[Discorb::Message]
119
+
120
+ # @return [Discorb::Snowflake] The ID of the channel the message was sent in.
121
+ attr_reader channel_id: Discorb::Snowflake
122
+
123
+ # @return [Discorb::Snowflake] The ID of the message.
124
+ attr_reader message_id: Discorb::Snowflake
125
+
126
+ # @return [Discorb::Snowflake] The ID of the guild the message was sent in.
127
+ attr_reader guild_id: Discorb::Snowflake
128
+
129
+ # @macro client_cache
130
+ # @return [Discorb::Channel] The channel the message was sent in.
131
+ attr_reader channel: Discorb::Channel?
132
+
133
+ # @macro client_cache
134
+ # @return [Discorb::Guild] The guild the message was sent in.
135
+ attr_reader guild: Discorb::Guild?
136
+
137
+ # @macro client_cache
138
+ # @return [Discorb::Message] The message the reaction was sent in.
139
+ attr_reader message: Discorb::Message?
140
+ end
141
+
142
+ #
143
+ # Represents a `MESSAGE_REACTION_REMOVE_EMOJI` event.
144
+ class ReactionRemoveEmojiEvent < Discorb::Gateway::GatewayEvent
145
+ #
146
+ # Initialize a new instance of the ReactionRemoveEmojiEvent class.
147
+ # @private
148
+ #
149
+ # @param [Discorb::Client] client The client that instantiated the object.
150
+ # @param [Hash] data The data of the event.
151
+ def initialize: (Discorb::Client client, Discorb::json data) -> void
152
+
153
+ # Fetch the message.
154
+ # If message is cached, it will be returned.
155
+ # @async
156
+ #
157
+ # @param [Boolean] force Whether to force fetching the message.
158
+ #
159
+ # @return [Async::Task<Discorb::Message>] The message.
160
+ def fetch_message: (?force: bool) -> Async::Task[Discorb::Message]
161
+
162
+ # @return [Discorb::Snowflake] The ID of the channel the message was sent in.
163
+ attr_reader channel_id: Discorb::Snowflake
164
+
165
+ # @return [Discorb::Snowflake] The ID of the message.
166
+ attr_reader message_id: Discorb::Snowflake
167
+
168
+ # @return [Discorb::Snowflake] The ID of the guild the message was sent in.
169
+ attr_reader guild_id: Discorb::Snowflake
170
+
171
+ # @macro client_cache
172
+ # @return [Discorb::Channel] The channel the message was sent in.
173
+ attr_reader channel: Discorb::Channel?
174
+
175
+ # @macro client_cache
176
+ # @return [Discorb::Guild] The guild the message was sent in.
177
+ attr_reader guild: Discorb::Guild?
178
+
179
+ # @macro client_cache
180
+ # @return [Discorb::Message] The message the reaction was sent in.
181
+ attr_reader message: Discorb::Message?
182
+
183
+ # @return [Discorb::UnicodeEmoji, Discorb::PartialEmoji] The emoji that was reacted with.
184
+ attr_reader emoji: Discorb::UnicodeEmoji | Discorb::PartialEmoji
185
+ end
186
+
187
+ #
188
+ # Represents a `GUILD_SCHEDULED_EVENT_USER_ADD` and `GUILD_SCHEDULED_EVENT_USER_REMOVE` event.
189
+ class ScheduledEventUserEvent < Discorb::Gateway::GatewayEvent
190
+ #
191
+ # Initialize a new instance of the ScheduledEventUserEvent class.
192
+ # @private
193
+ #
194
+ # @param [Discorb::Client] client The client that instantiated the object.
195
+ # @param [Hash] data The data of the event.
196
+ def initialize: (Discorb::Client client, Discorb::json data) -> void
197
+
198
+ # @return [Discorb::User] The user that triggered the event.
199
+ attr_reader user: Discorb::User
200
+
201
+ # @return [Discorb::Guild] The guild the event was triggered in.
202
+ attr_reader guild: Discorb::Guild
203
+
204
+ # @return [Discorb::ScheduledEvent] The scheduled event.
205
+ attr_reader scheduled_event: Discorb::ScheduledEvent
206
+ end
207
+
208
+ #
209
+ # Represents a `MESSAGE_UPDATE` event.
210
+ class MessageUpdateEvent < Discorb::Gateway::GatewayEvent
211
+ # @!attribute [r] channel
212
+ # @macro client_cache
213
+ # @return [Discorb::Channel] The channel the message was sent in.
214
+ # @!attribute [r] guild
215
+ # @macro client_cache
216
+ # @return [Discorb::Guild] The guild the message was sent in.
217
+ def initialize: (
218
+ untyped client,
219
+ untyped data,
220
+ untyped before,
221
+ untyped after
222
+ ) -> void
223
+
224
+ # Fetch the message.
225
+ # @async
226
+ #
227
+ # @return [Async::Task<Discorb::Message>] The message.
228
+ def fetch_message: -> Async::Task[Discorb::Message]
229
+
230
+ # @return [Discorb::Message] The message before update.
231
+ attr_reader before: Discorb::Message
232
+
233
+ # @return [Discorb::Message] The message after update.
234
+ attr_reader after: Discorb::Message
235
+
236
+ # @return [Discorb::Snowflake] The ID of the message.
237
+ attr_reader id: Discorb::Snowflake
238
+
239
+ # @return [Discorb::Snowflake] The ID of the channel the message was sent in.
240
+ attr_reader channel_id: Discorb::Snowflake
241
+
242
+ # @return [Discorb::Snowflake] The ID of the guild the message was sent in.
243
+ attr_reader guild_id: Discorb::Snowflake
244
+
245
+ # @return [String] The new content of the message.
246
+ attr_reader content: String
247
+
248
+ # @return [Time] The time the message was edited.
249
+ attr_reader timestamp: Time
250
+
251
+ # @return [Boolean] Whether the message pings @everyone.
252
+ attr_reader mention_everyone: bool
253
+
254
+ # @macro client_cache
255
+ # @return [Array<Discorb::Role>] The roles mentioned in the message.
256
+ attr_reader mention_roles: ::Array[Discorb::Role]?
257
+
258
+ # @return [Array<Discorb::Attachment>] The attachments in the message.
259
+ attr_reader attachments: ::Array[Discorb::Attachment]
260
+
261
+ # @return [Array<Discorb::Embed>] The embeds in the message.
262
+ attr_reader embeds: ::Array[Discorb::Embed]
263
+
264
+ # @macro client_cache
265
+ # @return [Discorb::Channel] The channel the message was sent in.
266
+ attr_reader channel: Discorb::Channel?
267
+
268
+ # @macro client_cache
269
+ # @return [Discorb::Guild] The guild the message was sent in.
270
+ attr_reader guild: Discorb::Guild?
271
+ end
272
+
273
+ #
274
+ # Represents a message but it has only ID.
275
+ class UnknownDeleteBulkMessage < Discorb::Gateway::GatewayEvent
276
+ #
277
+ # Initialize a new instance of the UnknownDeleteBulkMessage class.
278
+ # @private
279
+ #
280
+ # @param [Discorb::Client] client The client that instantiated the object.
281
+ # @param [Hash] data The data of the event.
282
+ def initialize: (
283
+ Discorb::Client client,
284
+ _ToS id,
285
+ Discorb::json data
286
+ ) -> void
287
+
288
+ # @return [Discorb::Snowflake] The ID of the message.
289
+ attr_reader id: Discorb::Snowflake
290
+
291
+ # @macro client_cache
292
+ # @return [Discorb::Channel] The channel the message was sent in.
293
+ attr_reader channel: Discorb::Channel?
294
+
295
+ # @macro client_cache
296
+ # @return [Discorb::Guild] The guild the message was sent in.
297
+ attr_reader guild: Discorb::Guild?
298
+ end
299
+
300
+ #
301
+ # Represents a `INVITE_DELETE` event.
302
+ class InviteDeleteEvent < Discorb::Gateway::GatewayEvent
303
+ #
304
+ # Initialize a new instance of the InviteDeleteEvent class.
305
+ # @private
306
+ #
307
+ # @param [Discorb::Client] client The client that instantiated the object.
308
+ # @param [Hash] data The data of the event.
309
+ def initialize: (Discorb::Client client, Discorb::json data) -> void
310
+
311
+ # @return [String] The invite code.
312
+ attr_reader code: String
313
+
314
+ # @macro client_cache
315
+ # @return [Discorb::Channel] The channel the message was sent in.
316
+ attr_reader channel: Discorb::Channel?
317
+
318
+ # @macro client_cache
319
+ # @return [Discorb::Guild] The guild the message was sent in.
320
+ attr_reader guild: Discorb::Guild?
321
+ end
322
+
323
+ #
324
+ # Represents a `TYPING_START` event.
325
+ class TypingStartEvent < Discorb::Gateway::GatewayEvent
326
+ #
327
+ # Initialize a new instance of the TypingStartEvent class.
328
+ # @private
329
+ #
330
+ # @param [Discorb::Client] client The client that instantiated the object.
331
+ # @param [Hash] data The data of the event.
332
+ def initialize: (Discorb::Client client, Discorb::json data) -> void
333
+
334
+ # @return [Discorb::Snowflake] The ID of the channel the user is typing in.
335
+ attr_reader user_id: Discorb::Snowflake
336
+
337
+ # @macro client_cache
338
+ # @return [Discorb::Channel] The channel the user is typing in.
339
+ attr_reader channel: Discorb::Channel?
340
+
341
+ # @macro client_cache
342
+ # @return [Discorb::Guild] The guild the user is typing in.
343
+ attr_reader guild: Discorb::Guild?
344
+
345
+ # @macro client_cache
346
+ # @return [Discorb::User, Discorb::Member] The user that is typing.
347
+ attr_reader user: Discorb::Member | Discorb::User
348
+ alias member user
349
+ end
350
+
351
+ #
352
+ # Represents a message pin event.
353
+ class MessagePinEvent < Discorb::Gateway::GatewayEvent
354
+ # @!attribute [r] pinned?
355
+ # @return [Boolean] Whether the message was pinned.
356
+ # @!attribute [r] unpinned?
357
+ # @return [Boolean] Whether the message was unpinned.
358
+ def initialize: (untyped client, untyped data, untyped message) -> void
359
+
360
+ # @return [Discorb::Message] The message that was pinned.
361
+ attr_reader message: Discorb::Message
362
+
363
+ # @return [:pinned, :unpinned] The type of event.
364
+ attr_reader type: Symbol
365
+
366
+ # @return [Boolean] Whether the message was pinned.
367
+ attr_reader pinned?: bool
368
+
369
+ # @return [Boolean] Whether the message was unpinned.
370
+ attr_reader unpinned?: bool
371
+ end
372
+
373
+ #
374
+ # Represents a `WEBHOOKS_UPDATE` event.
375
+ class WebhooksUpdateEvent < Discorb::Gateway::GatewayEvent
376
+ #
377
+ # Initialize a new instance of the WebhooksUpdateEvent class.
378
+ # @private
379
+ #
380
+ # @param [Discorb::Client] client The client that instantiated the object.
381
+ # @param [Hash] data The data of the event.
382
+ def initialize: (Discorb::Client client, Discorb::json data) -> void
383
+
384
+ # @macro client_cache
385
+ # @return [Discorb::Channel] The channel where the webhook was updated.
386
+ attr_reader channel: Discorb::Channel?
387
+
388
+ # @macro client_cache
389
+ # @return [Discorb::Guild] The guild where the webhook was updated.
390
+ attr_reader guild: Discorb::Guild?
391
+ end
392
+
393
+ #
394
+ # Represents a `AUTO_MODERATION_ACTION_EXECUTION` event.
395
+ class AutoModerationActionExecutionEvent < GatewayEvent
396
+ # @return [Discorb::Snowflake] The id of the rule.
397
+ attr_reader rule_id: Discorb::Snowflake
398
+
399
+ # @return [Symbol] The type of action that was executed.
400
+ attr_reader rule_trigger_type: Discorb::AutoModRule::trigger_type
401
+
402
+ # @return [Discorb::Snowflake] The id of the message that triggered the action.
403
+ # @return [nil] If the message was deleted.
404
+ attr_reader message_id: Discorb::Snowflake?
405
+
406
+ # @return [Discorb::Snowflake] The id of the system message that was sent.
407
+ # @return [nil] If the system message channel was not set.
408
+ attr_reader alert_system_message_id: Discorb::Snowflake?
409
+
410
+ # @return [String] The content of the message that was sent.
411
+ attr_reader content: String
412
+
413
+ # @return [String] The keyword that triggered the action.
414
+ # @return [nil] If the action was not triggered by a keyword.
415
+ attr_reader matched_keyword: String?
416
+
417
+ # @return [String] The content that triggered the action.
418
+ # @return [nil] If the action was not triggered by a keyword.
419
+ attr_reader matched_content: String?
420
+
421
+ # @return [Discorb::AutoModRule::Action] The action that was executed.
422
+ attr_reader action: Discorb::AutoModRule::Action
423
+
424
+ #
425
+ # Initialize a new instance of the AutoModerationActionExecutionEvent class.
426
+ # @private
427
+ #
428
+ # @param [Discorb::Client] client The client that instantiated the object.
429
+ # @param [Hash] data The data of the event.
430
+ def initialize: (Discorb::Client client, Discorb::json data) -> void
431
+
432
+ # @!attribute [r] guild
433
+ # @return [Discorb::Guild] The guild where the rule was executed.
434
+ %a{pure}
435
+ def guild: -> Discorb::Guild
436
+
437
+ # @!attribute [r] channel
438
+ # @return [Discorb::Channel] The channel where the rule was executed.
439
+ %a{pure}
440
+ def channel: -> Discorb::Channel
441
+
442
+ # @!attribute [r] member
443
+ # @return [Discorb::Member] The member that triggered the action.
444
+ %a{pure}
445
+ def member: -> Discorb::Member
446
+
447
+ alias user member
448
+ end
449
+
450
+ #
451
+ # A module to handle gateway events.
452
+ module Handler
453
+ def connect_gateway: (untyped reconnect) -> untyped
454
+
455
+ def send_gateway: (untyped opcode, **untyped value) -> untyped
456
+
457
+ def handle_gateway: (untyped payload, untyped reconnect) -> untyped
458
+
459
+ def handle_heartbeat: -> untyped
460
+
461
+ def handle_event: (untyped event_name, untyped data) -> untyped
462
+
463
+ def ready: -> untyped
464
+ end
465
+
466
+ #
467
+ # A class for connecting websocket with raw bytes data.
468
+ # @private
469
+ class RawConnection < Async::WebSocket::Connection
470
+ %a{pure}
471
+ def inspect: -> String
472
+
473
+ def closed?: -> bool
474
+
475
+ def close: -> untyped
476
+
477
+ def force_close: -> untyped
478
+
479
+ def io: -> untyped
480
+
481
+ def parse: (untyped buffer) -> untyped
482
+
483
+ def dump: (untyped object) -> untyped
484
+ end
485
+ end
486
+ end