discorb 0.17.1 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/lint.yml +1 -3
- data/.github/workflows/validate.yml +21 -0
- data/Changelog.md +10 -0
- data/Gemfile +6 -0
- data/Rakefile +210 -98
- data/Steepfile +28 -0
- data/docs/events.md +42 -6
- data/docs/tutorial.md +7 -7
- data/docs/voice_events.md +2 -2
- data/examples/commands/message.rb +12 -7
- data/examples/commands/permission.rb +2 -1
- data/examples/commands/slash.rb +23 -19
- data/examples/commands/user.rb +15 -12
- data/examples/components/authorization_button.rb +2 -1
- data/examples/components/select_menu.rb +4 -1
- data/examples/extension/main.rb +1 -0
- data/examples/extension/message_expander.rb +1 -0
- data/examples/sig/commands/message.rbs +5 -0
- data/examples/simple/eval.rb +1 -0
- data/examples/simple/ping_pong.rb +1 -0
- data/examples/simple/rolepanel.rb +16 -5
- data/examples/simple/shard.rb +2 -1
- data/examples/simple/wait_for_message.rb +3 -0
- data/exe/discorb +3 -3
- data/lib/discorb/allowed_mentions.rb +1 -1
- data/lib/discorb/app_command/command.rb +12 -13
- data/lib/discorb/app_command/handler.rb +20 -6
- data/lib/discorb/audit_logs.rb +6 -2
- data/lib/discorb/automod.rb +269 -0
- data/lib/discorb/channel/guild.rb +2 -1
- data/lib/discorb/channel/stage.rb +1 -1
- data/lib/discorb/channel/text.rb +11 -20
- data/lib/discorb/channel/thread.rb +15 -11
- data/lib/discorb/client.rb +12 -10
- data/lib/discorb/color.rb +37 -60
- data/lib/discorb/common.rb +1 -1
- data/lib/discorb/dictionary.rb +1 -1
- data/lib/discorb/embed.rb +4 -3
- data/lib/discorb/emoji.rb +2 -2
- data/lib/discorb/exe/about.rb +1 -1
- data/lib/discorb/exe/new.rb +1 -5
- data/lib/discorb/extension.rb +0 -4
- data/lib/discorb/flag.rb +2 -2
- data/lib/discorb/gateway.rb +21 -582
- data/lib/discorb/gateway_events.rb +638 -0
- data/lib/discorb/guild.rb +136 -17
- data/lib/discorb/guild_template.rb +1 -1
- data/lib/discorb/http.rb +47 -25
- data/lib/discorb/intents.rb +27 -18
- data/lib/discorb/interaction/command.rb +14 -10
- data/lib/discorb/interaction/response.rb +74 -14
- data/lib/discorb/member.rb +3 -3
- data/lib/discorb/message.rb +13 -11
- data/lib/discorb/message_meta.rb +2 -3
- data/lib/discorb/modules.rb +3 -2
- data/lib/discorb/presence.rb +4 -2
- data/lib/discorb/reaction.rb +2 -2
- data/lib/discorb/role.rb +1 -1
- data/lib/discorb/sticker.rb +3 -3
- data/lib/discorb/user.rb +2 -2
- data/lib/discorb/voice_state.rb +5 -5
- data/lib/discorb/webhook.rb +15 -6
- data/lib/discorb.rb +2 -2
- data/rbs_collection.lock.yaml +88 -96
- data/rbs_collection.yaml +21 -17
- data/sig/async.rbs +11 -5
- data/sig/discorb/activity.rbs +23 -0
- data/sig/discorb/allowed_mentions.rbs +44 -0
- data/sig/discorb/app_command/base.rbs +282 -0
- data/sig/discorb/app_command/handler.rbs +171 -0
- data/sig/discorb/application.rbs +142 -0
- data/sig/discorb/asset.rbs +32 -0
- data/sig/discorb/attachment.rbs +91 -0
- data/sig/discorb/audit_log.rbs +231 -0
- data/sig/discorb/automod.rbs +128 -0
- data/sig/discorb/avatar.rbs +26 -0
- data/sig/discorb/channel/base.rbs +179 -0
- data/sig/discorb/channel/category.rbs +56 -0
- data/sig/discorb/channel/container.rbs +29 -0
- data/sig/discorb/channel/dm.rbs +14 -0
- data/sig/discorb/channel/news.rbs +20 -0
- data/sig/discorb/channel/stage.rbs +77 -0
- data/sig/discorb/channel/text.rbs +158 -0
- data/sig/discorb/channel/thread.rbs +185 -0
- data/sig/discorb/channel/voice.rbs +41 -0
- data/sig/discorb/client.rbs +2495 -0
- data/sig/discorb/color.rbs +142 -0
- data/sig/discorb/component/base.rbs +28 -0
- data/sig/discorb/component/button.rbs +65 -0
- data/sig/discorb/component/select_menu.rbs +107 -0
- data/sig/discorb/component/text_input.rbs +69 -0
- data/sig/discorb/connectable.rbs +8 -0
- data/sig/discorb/custom_emoji.rbs +90 -0
- data/sig/discorb/dictionary.rbs +85 -0
- data/sig/discorb/discord_model.rbs +15 -0
- data/sig/discorb/embed.rbs +279 -0
- data/sig/discorb/emoji.rbs +13 -0
- data/sig/discorb/error.rbs +73 -0
- data/sig/discorb/event_handler.rbs +27 -0
- data/sig/discorb/extension.rbs +1734 -0
- data/sig/discorb/flag.rbs +72 -0
- data/sig/discorb/gateway.rbs +481 -0
- data/sig/discorb/guild.rbs +870 -0
- data/sig/discorb/guild_template.rbs +174 -0
- data/sig/discorb/http.rbs +147 -0
- data/sig/discorb/image.rbs +20 -0
- data/sig/discorb/integration.rbs +118 -0
- data/sig/discorb/intents.rbs +97 -0
- data/sig/discorb/interaction/autocomplete.rbs +9 -0
- data/sig/discorb/interaction/base.rbs +66 -0
- data/sig/discorb/interaction/command.rbs +66 -0
- data/sig/discorb/interaction/message_component.rbs +140 -0
- data/sig/discorb/interaction/modal.rbs +50 -0
- data/sig/discorb/interaction/responder.rbs +157 -0
- data/sig/discorb/invite.rbs +86 -0
- data/sig/discorb/member.rbs +187 -0
- data/sig/discorb/message.rbs +469 -0
- data/sig/discorb/messageable.rbs +153 -0
- data/sig/discorb/partial_emoji.rbs +35 -0
- data/sig/discorb/permissions.rbs +149 -0
- data/sig/discorb/presence.rbs +237 -0
- data/sig/discorb/reaction.rbs +33 -0
- data/sig/discorb/role.rbs +145 -0
- data/sig/discorb/scheduled_event.rbs +148 -0
- data/sig/discorb/shard.rbs +62 -0
- data/sig/discorb/snowflake.rbs +56 -0
- data/sig/discorb/stage_instance.rbs +63 -0
- data/sig/discorb/sticker.rbs +116 -0
- data/sig/discorb/system_channel_flag.rbs +17 -0
- data/sig/discorb/unicode_emoji.rbs +49 -0
- data/sig/discorb/user.rbs +93 -0
- data/sig/discorb/utils.rbs +8 -0
- data/sig/discorb/voice_region.rbs +30 -0
- data/sig/discorb/voice_state.rbs +71 -0
- data/sig/discorb/webhook.rbs +327 -0
- data/sig/discorb/welcome_screen.rbs +78 -0
- data/sig/discorb.rbs +5 -8661
- data/sig/manifest.yaml +3 -0
- data/sig/override.rbs +19 -0
- metadata +80 -3
|
@@ -0,0 +1,327 @@
|
|
|
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
|
+
def inspect: -> String
|
|
15
|
+
|
|
16
|
+
#
|
|
17
|
+
# Posts a message to the webhook.
|
|
18
|
+
# @async
|
|
19
|
+
#
|
|
20
|
+
# @param [String] content The content of the message.
|
|
21
|
+
# @param [Boolean] tts Whether the message should be sent as text-to-speech.
|
|
22
|
+
# @param [Discorb::Embed] embed The embed to send.
|
|
23
|
+
# @param [Array<Discorb::Embed>] embeds The embeds to send.
|
|
24
|
+
# @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions to send.
|
|
25
|
+
# @param [Discorb::Attachment] attachment The attachment to send.
|
|
26
|
+
# @param [Array<Discorb::Attachment>] attachment The attachments to send.
|
|
27
|
+
# @param [String] username The username of the message.
|
|
28
|
+
# @param [String] avatar_url The avatar URL of the message.
|
|
29
|
+
# @param [Boolean] wait Whether to wait for the message to be sent.
|
|
30
|
+
#
|
|
31
|
+
# @return [Discorb::Webhook::Message] The message that was sent.
|
|
32
|
+
# @return [Async::Task<nil>] If `wait` is false.
|
|
33
|
+
def post: (
|
|
34
|
+
?String? content,
|
|
35
|
+
?tts: bool,
|
|
36
|
+
?embed: Discorb::Embed?,
|
|
37
|
+
?embeds: ::Array[Discorb::Embed]?,
|
|
38
|
+
?allowed_mentions: Discorb::AllowedMentions?,
|
|
39
|
+
?attachment: Discorb::Attachment?,
|
|
40
|
+
?attachments: untyped,
|
|
41
|
+
?username: String?,
|
|
42
|
+
?avatar_url: String,
|
|
43
|
+
?wait: bool
|
|
44
|
+
) -> Discorb::Webhook::Message
|
|
45
|
+
|
|
46
|
+
#
|
|
47
|
+
# Edits the webhook.
|
|
48
|
+
# @async
|
|
49
|
+
# @macro edit
|
|
50
|
+
#
|
|
51
|
+
# @param [String] name The new name of the webhook.
|
|
52
|
+
# @param [Discorb::Image] avatar The new avatar of the webhook.
|
|
53
|
+
# @param [Discorb::GuildChannel] channel The new channel of the webhook.
|
|
54
|
+
#
|
|
55
|
+
# @return [Async::Task<void>] The task.
|
|
56
|
+
def edit: (
|
|
57
|
+
?name: String,
|
|
58
|
+
?avatar: Discorb::Image,
|
|
59
|
+
?channel: Discorb::GuildChannel
|
|
60
|
+
) -> Async::Task[void]
|
|
61
|
+
|
|
62
|
+
#
|
|
63
|
+
# Deletes the webhook.
|
|
64
|
+
# @async
|
|
65
|
+
#
|
|
66
|
+
# @return [Async::Task<void>] The task.
|
|
67
|
+
def delete!: -> Async::Task[void]
|
|
68
|
+
|
|
69
|
+
#
|
|
70
|
+
# Edits the webhook's message.
|
|
71
|
+
# @async
|
|
72
|
+
# @macro edit
|
|
73
|
+
#
|
|
74
|
+
# @param [Discorb::Webhook::Message] message The message to edit.
|
|
75
|
+
# @param [String] content The new content of the message.
|
|
76
|
+
# @param [Discorb::Embed] embed The new embed of the message.
|
|
77
|
+
# @param [Array<Discorb::Embed>] embeds The new embeds of the message.
|
|
78
|
+
# @param [Array<Discorb::Attachment>] attachments The attachments to remain.
|
|
79
|
+
# @param [Discorb::Attachment] file The file to send.
|
|
80
|
+
# @param [Array<Discorb::Attachment>] files The files to send.
|
|
81
|
+
# @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions to send.
|
|
82
|
+
#
|
|
83
|
+
# @return [Async::Task<void>] The task.
|
|
84
|
+
def edit_message: (
|
|
85
|
+
Discorb::Webhook::Message message,
|
|
86
|
+
?String content,
|
|
87
|
+
?embed: Discorb::Embed,
|
|
88
|
+
?embeds: ::Array[Discorb::Embed],
|
|
89
|
+
?file: Discorb::Attachment,
|
|
90
|
+
?files: ::Array[Discorb::Attachment],
|
|
91
|
+
?attachments: ::Array[Discorb::Attachment],
|
|
92
|
+
?allowed_mentions: Discorb::AllowedMentions
|
|
93
|
+
) -> Async::Task[void]
|
|
94
|
+
|
|
95
|
+
#
|
|
96
|
+
# Deletes the webhook's message.
|
|
97
|
+
#
|
|
98
|
+
# @param [Discorb::Webhook::Message] message The message to delete.
|
|
99
|
+
#
|
|
100
|
+
# @return [Async::Task<void>] The task.
|
|
101
|
+
def delete_message!: (
|
|
102
|
+
Discorb::Webhook::Message message
|
|
103
|
+
) -> Async::Task[void]
|
|
104
|
+
|
|
105
|
+
#
|
|
106
|
+
# Creates URLWebhook.
|
|
107
|
+
#
|
|
108
|
+
# @param [String] url The URL of the webhook.
|
|
109
|
+
#
|
|
110
|
+
# @return [Discorb::Webhook::URLWebhook] The URLWebhook.
|
|
111
|
+
def self.new: (
|
|
112
|
+
String url,
|
|
113
|
+
?client: Discorb::Client?
|
|
114
|
+
) -> Discorb::Webhook::URLWebhook
|
|
115
|
+
|
|
116
|
+
#
|
|
117
|
+
# Creates Webhook with discord data.
|
|
118
|
+
# @private
|
|
119
|
+
#
|
|
120
|
+
# @param [Discorb::Client] client The client.
|
|
121
|
+
# @param [Hash] data The data of the webhook.
|
|
122
|
+
#
|
|
123
|
+
# @return [Discorb::Webhook] The Webhook.
|
|
124
|
+
def self.from_data: (
|
|
125
|
+
Discorb::Client client,
|
|
126
|
+
Discorb::json data
|
|
127
|
+
) -> Discorb::Webhook
|
|
128
|
+
|
|
129
|
+
def self.from_url: (untyped url) -> untyped
|
|
130
|
+
|
|
131
|
+
# @return [String] The name of the webhook.
|
|
132
|
+
attr_reader name: String
|
|
133
|
+
|
|
134
|
+
# @return [Discorb::Snowflake] The ID of the guild this webhook belongs to.
|
|
135
|
+
attr_reader guild_id: Discorb::Snowflake
|
|
136
|
+
|
|
137
|
+
# @return [Discorb::Snowflake] The ID of the channel this webhook belongs to.
|
|
138
|
+
attr_reader channel_id: Discorb::Snowflake
|
|
139
|
+
|
|
140
|
+
# @return [Discorb::User] The user that created this webhook.
|
|
141
|
+
attr_reader user: Discorb::User
|
|
142
|
+
|
|
143
|
+
# @return [Discorb::Asset] The avatar of the webhook.
|
|
144
|
+
attr_reader avatar: Discorb::Asset
|
|
145
|
+
|
|
146
|
+
# @return [Discorb::Snowflake] The application ID of the webhook.
|
|
147
|
+
# @return [nil] If the webhook is not an application webhook.
|
|
148
|
+
attr_reader application_id: Discorb::Snowflake?
|
|
149
|
+
|
|
150
|
+
# @return [String] The URL of the webhook.
|
|
151
|
+
attr_reader token: String
|
|
152
|
+
|
|
153
|
+
#
|
|
154
|
+
# Represents a webhook from URL.
|
|
155
|
+
class URLWebhook < Discorb::Webhook
|
|
156
|
+
#
|
|
157
|
+
# Initializes the webhook from URL.
|
|
158
|
+
#
|
|
159
|
+
# @param [String] url The URL of the webhook.
|
|
160
|
+
def initialize: (String url, ?client: Discorb::Client?) -> void
|
|
161
|
+
|
|
162
|
+
# @return [String] The URL of the webhook.
|
|
163
|
+
attr_reader url: String
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
#
|
|
167
|
+
# Represents a bot created webhook.
|
|
168
|
+
class IncomingWebhook < Discorb::Webhook
|
|
169
|
+
#
|
|
170
|
+
# Initializes the incoming webhook.
|
|
171
|
+
# @private
|
|
172
|
+
#
|
|
173
|
+
# @param [Discorb::Client] client The client.
|
|
174
|
+
# @param [String] url The URL of the webhook.
|
|
175
|
+
def initialize: (Discorb::Client client, untyped data) -> void
|
|
176
|
+
|
|
177
|
+
# @return [String] The URL of the webhook.
|
|
178
|
+
attr_reader url: String
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
#
|
|
182
|
+
# Represents a webhook of channel following.
|
|
183
|
+
class FollowerWebhook < Discorb::Webhook
|
|
184
|
+
#
|
|
185
|
+
# Initializes the follower webhook.
|
|
186
|
+
# @private
|
|
187
|
+
#
|
|
188
|
+
# @param [Discorb::Client] client The client.
|
|
189
|
+
# @param [Hash] data The data of the follower webhook.
|
|
190
|
+
def initialize: (Discorb::Client client, Discorb::json data) -> void
|
|
191
|
+
|
|
192
|
+
# Represents a source guild of follower webhook.
|
|
193
|
+
# @return [Discorb::Guild, Discorb::Webhook::FollowerWebhook::Guild] The source guild of follower webhook.
|
|
194
|
+
attr_reader source_guild: Discorb::Guild
|
|
195
|
+
| Discorb::Webhook::FollowerWebhook::Guild
|
|
196
|
+
|
|
197
|
+
# Represents a source channel of follower webhook.
|
|
198
|
+
# @return [Discorb::Channel, Discorb::Webhook::FollowerWebhook::Channel] The source channel of follower webhook.
|
|
199
|
+
attr_reader source_channel: Discorb::Channel
|
|
200
|
+
| Discorb::Webhook::FollowerWebhook::Channel
|
|
201
|
+
|
|
202
|
+
#
|
|
203
|
+
# Represents a guild of follower webhook.
|
|
204
|
+
class Guild < Discorb::DiscordModel
|
|
205
|
+
#
|
|
206
|
+
# Initialize a new guild.
|
|
207
|
+
# @private
|
|
208
|
+
#
|
|
209
|
+
# @param [Hash] data The data of the guild.
|
|
210
|
+
def initialize: (Discorb::json data) -> void
|
|
211
|
+
|
|
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
|
+
def inspect: -> String
|
|
235
|
+
|
|
236
|
+
# @return [Discorb::Snowflake] The ID of the channel.
|
|
237
|
+
attr_reader id: Discorb::Snowflake
|
|
238
|
+
|
|
239
|
+
# @return [String] The name of the channel.
|
|
240
|
+
attr_reader name: String
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
#
|
|
245
|
+
# Represents a webhook from oauth2.
|
|
246
|
+
class ApplicationWebhook < Discorb::Webhook
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
#
|
|
250
|
+
# Represents a webhook message.
|
|
251
|
+
class Message < Discorb::Message
|
|
252
|
+
MESSAGE_TYPE: untyped
|
|
253
|
+
|
|
254
|
+
#
|
|
255
|
+
# Initializes the message.
|
|
256
|
+
# @private
|
|
257
|
+
#
|
|
258
|
+
# @param [Discorb::Webhook] webhook The webhook.
|
|
259
|
+
# @param [Hash] data The data of the message.
|
|
260
|
+
# @param [Discorb::Client] client The client. This will be nil if it's created from {URLWebhook}.
|
|
261
|
+
def initialize: (
|
|
262
|
+
Discorb::Webhook webhook,
|
|
263
|
+
Discorb::json data,
|
|
264
|
+
?Discorb::Client? client
|
|
265
|
+
) -> void
|
|
266
|
+
|
|
267
|
+
#
|
|
268
|
+
# Edits the message.
|
|
269
|
+
# @async
|
|
270
|
+
# @macro edit
|
|
271
|
+
#
|
|
272
|
+
# @param (see Webhook#edit_message)
|
|
273
|
+
#
|
|
274
|
+
# @return [Async::Task<void>] The task.
|
|
275
|
+
def edit: -> Async::Task[void]
|
|
276
|
+
|
|
277
|
+
#
|
|
278
|
+
# Deletes the message.
|
|
279
|
+
# @async
|
|
280
|
+
#
|
|
281
|
+
# @return [Async::Task<void>] The task.
|
|
282
|
+
def delete!: -> Async::Task[void]
|
|
283
|
+
|
|
284
|
+
# @return [Discorb::Snowflake] The ID of the channel.
|
|
285
|
+
attr_reader channel_id: Discorb::Snowflake
|
|
286
|
+
|
|
287
|
+
# @return [Discorb::Snowflake] The ID of the guild.
|
|
288
|
+
attr_reader guild_id: Discorb::Snowflake
|
|
289
|
+
|
|
290
|
+
#
|
|
291
|
+
# Represents an author of webhook message.
|
|
292
|
+
class Author < Discorb::DiscordModel
|
|
293
|
+
#
|
|
294
|
+
# Initializes the author.
|
|
295
|
+
# @private
|
|
296
|
+
#
|
|
297
|
+
# @param [Hash] data The data of the author.
|
|
298
|
+
def initialize: (Discorb::json data) -> void
|
|
299
|
+
|
|
300
|
+
#
|
|
301
|
+
# Format author with `Name#Discriminator` style.
|
|
302
|
+
#
|
|
303
|
+
# @return [String] Formatted author.
|
|
304
|
+
def to_s: -> String
|
|
305
|
+
|
|
306
|
+
def inspect: -> String
|
|
307
|
+
|
|
308
|
+
# @return [Boolean] Whether the author is a bot.
|
|
309
|
+
# @note This will be always `true`.
|
|
310
|
+
attr_reader bot: bool
|
|
311
|
+
alias bot? bot
|
|
312
|
+
|
|
313
|
+
# @return [Discorb::Snowflake] The ID of the author.
|
|
314
|
+
attr_reader id: Discorb::Snowflake
|
|
315
|
+
|
|
316
|
+
# @return [String] The name of the author.
|
|
317
|
+
attr_reader username: String
|
|
318
|
+
|
|
319
|
+
# @return [Discorb::Asset] The avatar of the author.
|
|
320
|
+
attr_reader avatar: Discorb::Asset | Discorb::DefaultAvatar
|
|
321
|
+
|
|
322
|
+
# @return [String] The discriminator of the author.
|
|
323
|
+
attr_reader discriminator: String
|
|
324
|
+
end
|
|
325
|
+
end
|
|
326
|
+
end
|
|
327
|
+
end
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
def to_hash: -> Discorb::json
|
|
48
|
+
|
|
49
|
+
#
|
|
50
|
+
# Edits the welcome screen.
|
|
51
|
+
# @async
|
|
52
|
+
# @macro edit
|
|
53
|
+
#
|
|
54
|
+
# @param [Boolean] enabled Whether the welcome screen is enabled.
|
|
55
|
+
# @param [Array<Discorb::WelcomeScreen::Channel>] channels The channels to display the welcome screen.
|
|
56
|
+
# @param [String] description The description of the welcome screen.
|
|
57
|
+
# @param [String] reason The reason for editing the welcome screen.
|
|
58
|
+
#
|
|
59
|
+
# @return [Async::Task<void>] The task.
|
|
60
|
+
def edit: (
|
|
61
|
+
?enabled: bool,
|
|
62
|
+
?channels: ::Array[Discorb::WelcomeScreen::Channel],
|
|
63
|
+
?description: String,
|
|
64
|
+
?reason: String?
|
|
65
|
+
) -> Async::Task[void]
|
|
66
|
+
|
|
67
|
+
# @return [String] The channel's name.
|
|
68
|
+
attr_reader description: String
|
|
69
|
+
|
|
70
|
+
# @return [Discorb::emoji] The emoji to display.
|
|
71
|
+
attr_reader emoji: Discorb::emoji
|
|
72
|
+
|
|
73
|
+
# @macro client_cache
|
|
74
|
+
# @return [Discorb::Channel] The channel to display the welcome screen.
|
|
75
|
+
attr_reader channel: Discorb::Channel?
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|