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,71 @@
1
+ module Discorb
2
+ #
3
+ # Represents a state of user in voice channel.
4
+ class VoiceState < Discorb::DiscordModel
5
+ #
6
+ # Initialize a new voice state.
7
+ # @private
8
+ #
9
+ # @param [Discorb::Client] client The client this voice state belongs to.
10
+ # @param [Hash] data The data of the voice state.
11
+ def initialize: (Discorb::Client client, Discorb::json data) -> void
12
+
13
+ # @return [Discorb::Member] The member associated with this voice state.
14
+ attr_reader member: Discorb::Member
15
+
16
+ # @return [Discorb::Snowflake] The ID of the guild this voice state is for.
17
+ attr_reader session_id: Discorb::Snowflake
18
+
19
+ # @return [Time] The time at which the user requested to speak.
20
+ attr_reader request_to_speak_timestamp: Time
21
+
22
+ # @return [Boolean] Whether the user is deafened.
23
+ attr_reader self_deaf: bool
24
+
25
+ alias self_deaf? self_deaf
26
+
27
+ # @return [Boolean] Whether the user is muted.
28
+ attr_reader self_mute: bool
29
+
30
+ alias self_mute? self_mute
31
+
32
+ # @return [Boolean] Whether the user is streaming.
33
+ attr_reader self_stream: bool
34
+
35
+ alias self_stream? self_stream
36
+
37
+ # @return [Boolean] Whether the user is video-enabled.
38
+ attr_reader self_video: bool
39
+
40
+ alias self_video? self_video
41
+
42
+ # @return [Boolean] Whether the user is suppressed. (Is at audience)
43
+ attr_reader suppress: bool
44
+
45
+ alias suppress? suppress
46
+
47
+ # @return [Boolean] Whether the user is deafened.
48
+ attr_reader deaf?: bool
49
+
50
+ # @return [Boolean] Whether the user is muted.
51
+ attr_reader mute?: bool
52
+
53
+ # @return [Boolean] Whether the user is deafened on the server.
54
+ attr_reader server_deaf?: bool
55
+
56
+ # @return [Boolean] Whether the user is muted on the server.
57
+ attr_reader server_mute?: bool
58
+
59
+ # @macro client_cache
60
+ # @return [Discorb::Guild] The guild this voice state is for.
61
+ attr_reader guild: Discorb::Guild
62
+
63
+ # @macro client_cache
64
+ # @return [Discorb::Channel] The channel this voice state is for.
65
+ attr_reader channel: Discorb::Channel
66
+
67
+ # @macro client_cache
68
+ # @return [Discorb::User] The user this voice state is for.
69
+ attr_reader user: Discorb::User
70
+ end
71
+ end
@@ -0,0 +1,338 @@
1
+ module Discorb
2
+ #
3
+ # Represents a webhook.
4
+ # @abstract
5
+ class Webhook
6
+ #
7
+ # Initializes a webhook.
8
+ # @private
9
+ #
10
+ # @param [Discorb::Client] client The client.
11
+ # @param [Hash] data The data of the webhook.
12
+ def initialize: (Discorb::Client client, Discorb::json data) -> void
13
+
14
+ %a{pure}
15
+ def inspect: -> String
16
+
17
+ #
18
+ # Posts a message to the webhook.
19
+ # @async
20
+ #
21
+ # @param [String] content The content of the message.
22
+ # @param [Boolean] tts Whether the message should be sent as text-to-speech.
23
+ # @param [Discorb::Embed] embed The embed to send.
24
+ # @param [Array<Discorb::Embed>] embeds The embeds to send.
25
+ # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions to send.
26
+ # @param [Discorb::Attachment] attachment The attachment to send.
27
+ # @param [Array<Discorb::Attachment>] attachment The attachments to send.
28
+ # @param [String] username The username of the message.
29
+ # @param [String] avatar_url The avatar URL of the message.
30
+ # @param [Boolean] wait Whether to wait for the message to be sent.
31
+ #
32
+ # @return [Discorb::Webhook::Message] The message that was sent.
33
+ # @return [Async::Task<nil>] If `wait` is false.
34
+ def post: (
35
+ ?String? content,
36
+ ?tts: bool,
37
+ ?embed: Discorb::Embed?,
38
+ ?embeds: ::Array[Discorb::Embed]?,
39
+ ?allowed_mentions: Discorb::AllowedMentions?,
40
+ ?attachment: Discorb::Attachment?,
41
+ ?attachments: untyped,
42
+ ?username: String?,
43
+ ?avatar_url: String,
44
+ ?wait: bool
45
+ ) -> Discorb::Webhook::Message
46
+
47
+ #
48
+ # Edits the webhook.
49
+ # @async
50
+ # @macro edit
51
+ #
52
+ # @param [String] name The new name of the webhook.
53
+ # @param [Discorb::Image] avatar The new avatar of the webhook.
54
+ # @param [Discorb::GuildChannel] channel The new channel of the webhook.
55
+ #
56
+ # @return [Async::Task<void>] The task.
57
+ def edit: (
58
+ ?name: String,
59
+ ?avatar: Discorb::Image,
60
+ ?channel: Discorb::GuildChannel
61
+ ) -> Async::Task[void]
62
+
63
+ #
64
+ # Deletes the webhook.
65
+ # @async
66
+ #
67
+ # @return [Async::Task<void>] The task.
68
+ def delete: -> Async::Task[void]
69
+
70
+ #
71
+ # Edits the webhook's message.
72
+ # @async
73
+ # @macro edit
74
+ #
75
+ # @param [Discorb::Webhook::Message] message The message to edit.
76
+ # @param [String] content The new content of the message.
77
+ # @param [Discorb::Embed] embed The new embed of the message.
78
+ # @param [Array<Discorb::Embed>] embeds The new embeds of the message.
79
+ # @param [Array<Discorb::Attachment>] attachments The attachments to remain.
80
+ # @param [Discorb::Attachment] file The file to send.
81
+ # @param [Array<Discorb::Attachment>] files The files to send.
82
+ # @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions to send.
83
+ #
84
+ # @return [Async::Task<void>] The task.
85
+ def edit_message: (
86
+ Discorb::Webhook::Message message,
87
+ ?String content,
88
+ ?embed: Discorb::Embed,
89
+ ?embeds: ::Array[Discorb::Embed],
90
+ ?file: Discorb::Attachment,
91
+ ?files: ::Array[Discorb::Attachment],
92
+ ?attachments: ::Array[Discorb::Attachment],
93
+ ?allowed_mentions: Discorb::AllowedMentions
94
+ ) -> Async::Task[void]
95
+
96
+ #
97
+ # Deletes the webhook's message.
98
+ #
99
+ # @param [Discorb::Webhook::Message] message The message to delete.
100
+ #
101
+ # @return [Async::Task<void>] The task.
102
+ def delete_message: (Discorb::Webhook::Message message) -> Async::Task[void]
103
+
104
+ #
105
+ # Creates URLWebhook.
106
+ #
107
+ # @param [String] url The URL of the webhook.
108
+ #
109
+ # @return [Discorb::Webhook::URLWebhook] The URLWebhook.
110
+ def self.new: (
111
+ String url,
112
+ ?client: Discorb::Client?
113
+ ) -> Discorb::Webhook::URLWebhook
114
+
115
+ #
116
+ # Creates Webhook with discord data.
117
+ # @private
118
+ #
119
+ # @param [Discorb::Client] client The client.
120
+ # @param [Hash] data The data of the webhook.
121
+ #
122
+ # @return [Discorb::Webhook] The Webhook.
123
+ def self.from_data: (
124
+ Discorb::Client client,
125
+ Discorb::json data
126
+ ) -> Discorb::Webhook
127
+
128
+ def self.from_url: (untyped url) -> untyped
129
+
130
+ # @return [String] The name of the webhook.
131
+ attr_reader name: String
132
+
133
+ # @return [Discorb::Snowflake] The ID of the guild this webhook belongs to.
134
+ attr_reader guild_id: Discorb::Snowflake
135
+
136
+ # @return [Discorb::Snowflake] The ID of the channel this webhook belongs to.
137
+ attr_reader channel_id: Discorb::Snowflake
138
+
139
+ # @return [Discorb::User] The user that created this webhook.
140
+ attr_reader user: Discorb::User
141
+
142
+ # @return [Discorb::Asset] The avatar of the webhook.
143
+ attr_reader avatar: Discorb::Asset
144
+
145
+ # @return [Discorb::Snowflake] The application ID of the webhook.
146
+ # @return [nil] If the webhook is not an application webhook.
147
+ attr_reader application_id: Discorb::Snowflake?
148
+
149
+ # @return [String] The URL of the webhook.
150
+ attr_reader token: String
151
+
152
+ #
153
+ # Represents a webhook from URL.
154
+ class URLWebhook < Discorb::Webhook
155
+ #
156
+ # Initializes the webhook from URL.
157
+ #
158
+ # @param [String] url The URL of the webhook.
159
+ def initialize: (String url, ?client: Discorb::Client?) -> void
160
+
161
+ # @return [String] The URL of the webhook.
162
+ attr_reader url: String
163
+ end
164
+
165
+ #
166
+ # Represents a bot created webhook.
167
+ class IncomingWebhook < Discorb::Webhook
168
+ #
169
+ # Initializes the incoming webhook.
170
+ # @private
171
+ #
172
+ # @param [Discorb::Client] client The client.
173
+ # @param [String] url The URL of the webhook.
174
+ def initialize: (Discorb::Client client, untyped data) -> void
175
+
176
+ # @return [String] The URL of the webhook.
177
+ attr_reader url: String
178
+ end
179
+
180
+ #
181
+ # Represents a webhook of channel following.
182
+ class FollowerWebhook < Discorb::Webhook
183
+ #
184
+ # Initializes the follower webhook.
185
+ # @private
186
+ #
187
+ # @param [Discorb::Client] client The client.
188
+ # @param [Hash] data The data of the follower webhook.
189
+ def initialize: (Discorb::Client client, Discorb::json data) -> void
190
+
191
+ # Represents a source guild of follower webhook.
192
+ # @return [Discorb::Guild, Discorb::Webhook::FollowerWebhook::Guild] The source guild of follower webhook.
193
+ attr_reader source_guild: Discorb::Guild
194
+ | Discorb::Webhook::FollowerWebhook::Guild
195
+
196
+ # Represents a source channel of follower webhook.
197
+ # @return [Discorb::Channel, Discorb::Webhook::FollowerWebhook::Channel] The source channel of follower webhook.
198
+ attr_reader source_channel: Discorb::Channel
199
+ | Discorb::Webhook::FollowerWebhook::Channel
200
+
201
+ #
202
+ # Represents a guild of follower webhook.
203
+ class Guild < Discorb::DiscordModel
204
+ #
205
+ # Initialize a new guild.
206
+ # @private
207
+ #
208
+ # @param [Hash] data The data of the guild.
209
+ def initialize: (Discorb::json data) -> void
210
+
211
+ %a{pure}
212
+ def inspect: -> String
213
+
214
+ # @return [Discorb::Snowflake] The ID of the guild.
215
+ attr_reader id: Discorb::Snowflake
216
+
217
+ # @return [String] The name of the guild.
218
+ attr_reader name: String
219
+
220
+ # @return [Discorb::Asset] The icon of the guild.
221
+ attr_reader icon: Discorb::Asset
222
+ end
223
+
224
+ #
225
+ # Represents a channel of follower webhook.
226
+ class Channel < Discorb::DiscordModel
227
+ #
228
+ # Initialize a new channel.
229
+ # @private
230
+ #
231
+ # @param [Hash] data The data of the channel.
232
+ def initialize: (Discorb::json data) -> void
233
+
234
+ %a{pure}
235
+ def inspect: -> String
236
+
237
+ # @return [Discorb::Snowflake] The ID of the channel.
238
+ attr_reader id: Discorb::Snowflake
239
+
240
+ # @return [String] The name of the channel.
241
+ attr_reader name: String
242
+ end
243
+ end
244
+
245
+ #
246
+ # Represents a webhook from oauth2.
247
+ class ApplicationWebhook < Discorb::Webhook
248
+ end
249
+
250
+ #
251
+ # Represents a webhook message.
252
+ class Message < Discorb::Message
253
+ MESSAGE_TYPE: untyped
254
+
255
+ #
256
+ # Initializes the message.
257
+ # @private
258
+ #
259
+ # @param [Discorb::Webhook] webhook The webhook.
260
+ # @param [Hash] data The data of the message.
261
+ # @param [Discorb::Client] client The client. This will be nil if it's created from {URLWebhook}.
262
+ def initialize: (
263
+ Discorb::Webhook webhook,
264
+ Discorb::json data,
265
+ ?Discorb::Client? client
266
+ ) -> void
267
+
268
+ #
269
+ # Edits the message.
270
+ # @async
271
+ # @macro edit
272
+ #
273
+ # @param (see Webhook#edit_message)
274
+ #
275
+ # @return [Async::Task<void>] The task.
276
+ def edit: (
277
+ ?String content,
278
+ ?embed: Discorb::Embed,
279
+ ?embeds: ::Array[Discorb::Embed],
280
+ ?file: Discorb::Attachment,
281
+ ?files: ::Array[Discorb::Attachment],
282
+ ?attachments: ::Array[Discorb::Attachment],
283
+ ?allowed_mentions: Discorb::AllowedMentions
284
+ ) -> Async::Task[void]
285
+
286
+ #
287
+ # Deletes the message.
288
+ # @async
289
+ #
290
+ # @return [Async::Task<void>] The task.
291
+ def delete: -> Async::Task[void]
292
+
293
+ # @return [Discorb::Snowflake] The ID of the channel.
294
+ attr_reader channel_id: Discorb::Snowflake
295
+
296
+ # @return [Discorb::Snowflake] The ID of the guild.
297
+ attr_reader guild_id: Discorb::Snowflake
298
+
299
+ #
300
+ # Represents an author of webhook message.
301
+ class Author < Discorb::DiscordModel
302
+ #
303
+ # Initializes the author.
304
+ # @private
305
+ #
306
+ # @param [Hash] data The data of the author.
307
+ def initialize: (Discorb::json data) -> void
308
+
309
+ #
310
+ # Format author with `Name#Discriminator` style.
311
+ #
312
+ # @return [String] Formatted author.
313
+ %a{pure}
314
+ def to_s: -> String
315
+
316
+ %a{pure}
317
+ def inspect: -> String
318
+
319
+ # @return [Boolean] Whether the author is a bot.
320
+ # @note This will be always `true`.
321
+ attr_reader bot: bool
322
+ alias bot? bot
323
+
324
+ # @return [Discorb::Snowflake] The ID of the author.
325
+ attr_reader id: Discorb::Snowflake
326
+
327
+ # @return [String] The name of the author.
328
+ attr_reader username: String
329
+
330
+ # @return [Discorb::Asset] The avatar of the author.
331
+ attr_reader avatar: Discorb::Asset | Discorb::DefaultAvatar
332
+
333
+ # @return [String] The discriminator of the author.
334
+ attr_reader discriminator: String
335
+ end
336
+ end
337
+ end
338
+ end
@@ -0,0 +1,79 @@
1
+ module Discorb
2
+ #
3
+ # Represents a welcome screen.
4
+ class WelcomeScreen < Discorb::DiscordModel
5
+ #
6
+ # Initializes the welcome screen.
7
+ # @private
8
+ #
9
+ # @param [Discorb::Client] client The client.
10
+ # @param [Discorb::Guild] guild The guild the welcome screen belongs to.
11
+ # @param [Hash] data The data of the welcome screen.
12
+ def initialize: (
13
+ Discorb::Client client,
14
+ Discorb::Guild guild,
15
+ Discorb::json data
16
+ ) -> void
17
+
18
+ # @return [String] The description of the welcome screen.
19
+ attr_reader description: String
20
+
21
+ # @return [Array<Discorb::WelcomeScreen::Channel>] The channels to display the welcome screen.
22
+ attr_reader channels: ::Array[Discorb::WelcomeScreen::Channel]
23
+
24
+ # @return [Discorb::Guild] The guild the welcome screen belongs to.
25
+ attr_reader guild: Discorb::Guild
26
+
27
+ #
28
+ # Represents a channel to display the welcome screen.
29
+ class Channel < Discorb::DiscordModel
30
+ #
31
+ # Initialize a new welcome screen channel.
32
+ #
33
+ # @param [Discorb::TextChannel] channel The channel to display the welcome screen.
34
+ # @param [String] description The channel's name.
35
+ # @param [Discorb::emoji] emoji The emoji to display.
36
+ def initialize: (
37
+ Discorb::TextChannel channel,
38
+ String description,
39
+ Discorb::emoji emoji
40
+ ) -> void
41
+
42
+ #
43
+ # Converts the channel to a hash.
44
+ #
45
+ # @return [Hash] The hash.
46
+ # @see https://discord.com/developers/docs/resources/guild#welcome-screen-object
47
+ %a{pure}
48
+ def to_hash: -> Discorb::json
49
+
50
+ #
51
+ # Edits the welcome screen.
52
+ # @async
53
+ # @macro edit
54
+ #
55
+ # @param [Boolean] enabled Whether the welcome screen is enabled.
56
+ # @param [Array<Discorb::WelcomeScreen::Channel>] channels The channels to display the welcome screen.
57
+ # @param [String] description The description of the welcome screen.
58
+ # @param [String] reason The reason for editing the welcome screen.
59
+ #
60
+ # @return [Async::Task<void>] The task.
61
+ def edit: (
62
+ ?enabled: bool,
63
+ ?channels: ::Array[Discorb::WelcomeScreen::Channel],
64
+ ?description: String,
65
+ ?reason: String?
66
+ ) -> Async::Task[void]
67
+
68
+ # @return [String] The channel's name.
69
+ attr_reader description: String
70
+
71
+ # @return [Discorb::emoji] The emoji to display.
72
+ attr_reader emoji: Discorb::emoji
73
+
74
+ # @macro client_cache
75
+ # @return [Discorb::Channel] The channel to display the welcome screen.
76
+ attr_reader channel: Discorb::Channel?
77
+ end
78
+ end
79
+ end