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.
Files changed (141) 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 +10 -0
  5. data/Gemfile +6 -0
  6. data/Rakefile +210 -98
  7. data/Steepfile +28 -0
  8. data/docs/events.md +42 -6
  9. data/docs/tutorial.md +7 -7
  10. data/docs/voice_events.md +2 -2
  11. data/examples/commands/message.rb +12 -7
  12. data/examples/commands/permission.rb +2 -1
  13. data/examples/commands/slash.rb +23 -19
  14. data/examples/commands/user.rb +15 -12
  15. data/examples/components/authorization_button.rb +2 -1
  16. data/examples/components/select_menu.rb +4 -1
  17. data/examples/extension/main.rb +1 -0
  18. data/examples/extension/message_expander.rb +1 -0
  19. data/examples/sig/commands/message.rbs +5 -0
  20. data/examples/simple/eval.rb +1 -0
  21. data/examples/simple/ping_pong.rb +1 -0
  22. data/examples/simple/rolepanel.rb +16 -5
  23. data/examples/simple/shard.rb +2 -1
  24. data/examples/simple/wait_for_message.rb +3 -0
  25. data/exe/discorb +3 -3
  26. data/lib/discorb/allowed_mentions.rb +1 -1
  27. data/lib/discorb/app_command/command.rb +12 -13
  28. data/lib/discorb/app_command/handler.rb +20 -6
  29. data/lib/discorb/audit_logs.rb +6 -2
  30. data/lib/discorb/automod.rb +269 -0
  31. data/lib/discorb/channel/guild.rb +2 -1
  32. data/lib/discorb/channel/stage.rb +1 -1
  33. data/lib/discorb/channel/text.rb +11 -20
  34. data/lib/discorb/channel/thread.rb +15 -11
  35. data/lib/discorb/client.rb +12 -10
  36. data/lib/discorb/color.rb +37 -60
  37. data/lib/discorb/common.rb +1 -1
  38. data/lib/discorb/dictionary.rb +1 -1
  39. data/lib/discorb/embed.rb +4 -3
  40. data/lib/discorb/emoji.rb +2 -2
  41. data/lib/discorb/exe/about.rb +1 -1
  42. data/lib/discorb/exe/new.rb +1 -5
  43. data/lib/discorb/extension.rb +0 -4
  44. data/lib/discorb/flag.rb +2 -2
  45. data/lib/discorb/gateway.rb +21 -582
  46. data/lib/discorb/gateway_events.rb +638 -0
  47. data/lib/discorb/guild.rb +136 -17
  48. data/lib/discorb/guild_template.rb +1 -1
  49. data/lib/discorb/http.rb +47 -25
  50. data/lib/discorb/intents.rb +27 -18
  51. data/lib/discorb/interaction/command.rb +14 -10
  52. data/lib/discorb/interaction/response.rb +74 -14
  53. data/lib/discorb/member.rb +3 -3
  54. data/lib/discorb/message.rb +13 -11
  55. data/lib/discorb/message_meta.rb +2 -3
  56. data/lib/discorb/modules.rb +3 -2
  57. data/lib/discorb/presence.rb +4 -2
  58. data/lib/discorb/reaction.rb +2 -2
  59. data/lib/discorb/role.rb +1 -1
  60. data/lib/discorb/sticker.rb +3 -3
  61. data/lib/discorb/user.rb +2 -2
  62. data/lib/discorb/voice_state.rb +5 -5
  63. data/lib/discorb/webhook.rb +15 -6
  64. data/lib/discorb.rb +2 -2
  65. data/rbs_collection.lock.yaml +88 -96
  66. data/rbs_collection.yaml +21 -17
  67. data/sig/async.rbs +11 -5
  68. data/sig/discorb/activity.rbs +23 -0
  69. data/sig/discorb/allowed_mentions.rbs +44 -0
  70. data/sig/discorb/app_command/base.rbs +282 -0
  71. data/sig/discorb/app_command/handler.rbs +171 -0
  72. data/sig/discorb/application.rbs +142 -0
  73. data/sig/discorb/asset.rbs +32 -0
  74. data/sig/discorb/attachment.rbs +91 -0
  75. data/sig/discorb/audit_log.rbs +231 -0
  76. data/sig/discorb/automod.rbs +128 -0
  77. data/sig/discorb/avatar.rbs +26 -0
  78. data/sig/discorb/channel/base.rbs +179 -0
  79. data/sig/discorb/channel/category.rbs +56 -0
  80. data/sig/discorb/channel/container.rbs +29 -0
  81. data/sig/discorb/channel/dm.rbs +14 -0
  82. data/sig/discorb/channel/news.rbs +20 -0
  83. data/sig/discorb/channel/stage.rbs +77 -0
  84. data/sig/discorb/channel/text.rbs +158 -0
  85. data/sig/discorb/channel/thread.rbs +185 -0
  86. data/sig/discorb/channel/voice.rbs +41 -0
  87. data/sig/discorb/client.rbs +2495 -0
  88. data/sig/discorb/color.rbs +142 -0
  89. data/sig/discorb/component/base.rbs +28 -0
  90. data/sig/discorb/component/button.rbs +65 -0
  91. data/sig/discorb/component/select_menu.rbs +107 -0
  92. data/sig/discorb/component/text_input.rbs +69 -0
  93. data/sig/discorb/connectable.rbs +8 -0
  94. data/sig/discorb/custom_emoji.rbs +90 -0
  95. data/sig/discorb/dictionary.rbs +85 -0
  96. data/sig/discorb/discord_model.rbs +15 -0
  97. data/sig/discorb/embed.rbs +279 -0
  98. data/sig/discorb/emoji.rbs +13 -0
  99. data/sig/discorb/error.rbs +73 -0
  100. data/sig/discorb/event_handler.rbs +27 -0
  101. data/sig/discorb/extension.rbs +1734 -0
  102. data/sig/discorb/flag.rbs +72 -0
  103. data/sig/discorb/gateway.rbs +481 -0
  104. data/sig/discorb/guild.rbs +870 -0
  105. data/sig/discorb/guild_template.rbs +174 -0
  106. data/sig/discorb/http.rbs +147 -0
  107. data/sig/discorb/image.rbs +20 -0
  108. data/sig/discorb/integration.rbs +118 -0
  109. data/sig/discorb/intents.rbs +97 -0
  110. data/sig/discorb/interaction/autocomplete.rbs +9 -0
  111. data/sig/discorb/interaction/base.rbs +66 -0
  112. data/sig/discorb/interaction/command.rbs +66 -0
  113. data/sig/discorb/interaction/message_component.rbs +140 -0
  114. data/sig/discorb/interaction/modal.rbs +50 -0
  115. data/sig/discorb/interaction/responder.rbs +157 -0
  116. data/sig/discorb/invite.rbs +86 -0
  117. data/sig/discorb/member.rbs +187 -0
  118. data/sig/discorb/message.rbs +469 -0
  119. data/sig/discorb/messageable.rbs +153 -0
  120. data/sig/discorb/partial_emoji.rbs +35 -0
  121. data/sig/discorb/permissions.rbs +149 -0
  122. data/sig/discorb/presence.rbs +237 -0
  123. data/sig/discorb/reaction.rbs +33 -0
  124. data/sig/discorb/role.rbs +145 -0
  125. data/sig/discorb/scheduled_event.rbs +148 -0
  126. data/sig/discorb/shard.rbs +62 -0
  127. data/sig/discorb/snowflake.rbs +56 -0
  128. data/sig/discorb/stage_instance.rbs +63 -0
  129. data/sig/discorb/sticker.rbs +116 -0
  130. data/sig/discorb/system_channel_flag.rbs +17 -0
  131. data/sig/discorb/unicode_emoji.rbs +49 -0
  132. data/sig/discorb/user.rbs +93 -0
  133. data/sig/discorb/utils.rbs +8 -0
  134. data/sig/discorb/voice_region.rbs +30 -0
  135. data/sig/discorb/voice_state.rbs +71 -0
  136. data/sig/discorb/webhook.rbs +327 -0
  137. data/sig/discorb/welcome_screen.rbs +78 -0
  138. data/sig/discorb.rbs +5 -8661
  139. data/sig/manifest.yaml +3 -0
  140. data/sig/override.rbs +19 -0
  141. metadata +80 -3
@@ -0,0 +1,870 @@
1
+ module Discorb
2
+ #
3
+ # Represents a guild in the Discord.
4
+ class Guild < Discorb::DiscordModel
5
+ include Discorb::ChannelContainer
6
+ MFA_LEVELS: untyped
7
+ NSFW_LEVELS: untyped
8
+ VERIFICATION_LEVELS: untyped
9
+ DEFAULT_MESSAGE_NOTIFICATIONS: untyped
10
+ EXPLICIT_CONTENT_FILTER: untyped
11
+
12
+ #
13
+ # Creates a new guild object.
14
+ # @private
15
+ #
16
+ # @param [Discorb::Client] client The client that owns this guild.
17
+ # @param [Hash] data The data of the guild.
18
+ # @param [Boolean] is_create_event Whether the guild is created by a `GUILD_CREATE` event.
19
+ def initialize: (
20
+ Discorb::Client client,
21
+ Discorb::json data,
22
+ bool is_create_event
23
+ ) -> void
24
+
25
+ def inspect: -> String
26
+
27
+ #
28
+ # Leave the guild.
29
+ # @async
30
+ #
31
+ # @return [Async::Task<void>] The task.
32
+ def leave!: -> Async::Task[void]
33
+
34
+ #
35
+ # Fetch scheduled events for the guild.
36
+ # @async
37
+ #
38
+ # @param [Boolean] with_user_count Whether to include the user count in the events.
39
+ # Defaults to `true`.
40
+ #
41
+ # @return [Array<Discorb::ScheduledEvent>] The events for the guild.
42
+ def fetch_scheduled_events: (
43
+ ?with_user_count: bool
44
+ ) -> ::Array[Discorb::ScheduledEvent]
45
+
46
+ #
47
+ # Fetch the scheduled event by ID.
48
+ # @async
49
+ #
50
+ # @param [#to_s] id The ID of the scheduled event.
51
+ #
52
+ # @return [Async::Task<Discorb::ScheduledEvent>] The event with the given ID.
53
+ # @return [Async::Task<nil>] If no event with the given ID exists.
54
+ def fetch_scheduled_event: (_ToS id) -> Async::Task[Discorb::ScheduledEvent]
55
+
56
+ #
57
+ # Create a scheduled event for the guild.
58
+ # @async
59
+ #
60
+ # @param [:stage_instance, :voice, :external] type The type of event to create.
61
+ # @param [String] name The name of the event.
62
+ # @param [String] description The description of the event.
63
+ # @param [Time] start_time The start time of the event.
64
+ # @param [Time, nil] end_time The end time of the event. Defaults to `nil`.
65
+ # @param [Discorb::Channel, Discorb::Snowflake, nil] channel The channel to run the event in.
66
+ # @param [String, nil] location The location of the event. Defaults to `nil`.
67
+ # @param [:guild_only] privacy_level The privacy level of the event. This must be `:guild_only`.
68
+ #
69
+ # @return [Async::Task<Discorb::ScheduledEvent>] The created event.
70
+ def create_scheduled_event: (
71
+ Symbol `type`,
72
+ String name,
73
+ String description,
74
+ Time start_time,
75
+ ?Time? end_time,
76
+ ?privacy_level: Symbol,
77
+ ?location: String?,
78
+ ?channel: (Discorb::Channel | Discorb::Snowflake)?
79
+ ) -> Async::Task[Discorb::ScheduledEvent]
80
+
81
+ #
82
+ # Fetch emoji list of the guild.
83
+ # @async
84
+ # @note This querys the API every time. We recommend using {#emojis} instead.
85
+ #
86
+ # @return [Async::Task<Discorb::Dictionary{Discorb::Snowflake => Discorb::CustomEmoji}>]
87
+ # A dictionary of emoji in the guild.
88
+ def fetch_emoji_list: -> Async::Task[Discorb::Dictionary[Discorb::Snowflake, Discorb::CustomEmoji]]
89
+
90
+ #
91
+ # Fetch emoji id of the guild.
92
+ # @async
93
+ # @note This querys the API every time. We recommend using {#emojis} instead.
94
+ #
95
+ # @param [#to_s] id The emoji id.
96
+ #
97
+ # @return [Async::Task<Discorb::CustomEmoji>] The emoji with the given id.
98
+ def fetch_emoji: (_ToS id) -> Async::Task[Discorb::CustomEmoji]
99
+
100
+ #
101
+ # Create a custom emoji.
102
+ # @async
103
+ #
104
+ # @param [#to_s] name The name of the emoji.
105
+ # @param [Discorb::Image] image The image of the emoji.
106
+ # @param [Array<Discorb::Role>] roles A list of roles to give the emoji.
107
+ #
108
+ # @return [Async::Task<Discorb::CustomEmoji>] The created emoji.
109
+ def create_emoji: (
110
+ untyped name,
111
+ Discorb::Image image,
112
+ ?roles: ::Array[Discorb::Role]
113
+ ) -> Async::Task[Discorb::CustomEmoji]
114
+
115
+ #
116
+ # Fetch webhooks of the guild.
117
+ # @async
118
+ #
119
+ # @return [Async::Task<Array<Discorb::Webhook>>] A list of webhooks in the guild.
120
+ def fetch_webhooks: -> Async::Task[::Array[Discorb::Webhook]]
121
+
122
+ #
123
+ # Fetch audit log of the guild.
124
+ # @async
125
+ #
126
+ # @return [Async::Task<Discorb::AuditLog>] The audit log of the guild.
127
+ def fetch_audit_log: -> Async::Task[Discorb::AuditLog]
128
+
129
+ #
130
+ # Fetch channels of the guild.
131
+ # @async
132
+ #
133
+ # @return [Async::Task<Array<Discorb::Channel>>] A list of channels in the guild.
134
+ def fetch_channels: -> Async::Task[::Array[Discorb::Channel]]
135
+
136
+ #
137
+ # Create a new text channel.
138
+ # @async
139
+ #
140
+ # @param [String] name The name of the channel.
141
+ # @param [String] topic The topic of the channel.
142
+ # @param [Integer] rate_limit_per_user The rate limit per user in the channel.
143
+ # @param [Integer] slowmode Alias for `rate_limit_per_user`.
144
+ # @param [Integer] position The position of the channel.
145
+ # @param [Boolean] nsfw Whether the channel is nsfw.
146
+ # @param [Hash{Discorb::Role, Discorb::Member => Discorb::PermissionOverwrite}] permission_overwrites
147
+ # A list of permission overwrites.
148
+ # @param [Discorb::CategoryChannel] parent The parent of the channel.
149
+ # @param [String] reason The reason for creating the channel.
150
+ #
151
+ # @return [Async::Task<Discorb::TextChannel>] The created text channel.
152
+ def create_text_channel: (
153
+ String name,
154
+ ?topic: String?,
155
+ ?rate_limit_per_user: Integer?,
156
+ ?slowmode: Integer?,
157
+ ?position: Integer?,
158
+ ?nsfw: bool?,
159
+ ?permission_overwrites: Hash[(Discorb::Role
160
+ | Discorb::Member), Discorb::PermissionOverwrite]?,
161
+ ?parent: Discorb::CategoryChannel?,
162
+ ?reason: String?
163
+ ) -> Async::Task[Discorb::TextChannel]
164
+
165
+ #
166
+ # Create a new voice channel.
167
+ # @async
168
+ #
169
+ # @param [String] name The name of the channel.
170
+ # @param [Integer] bitrate The bitrate of the channel.
171
+ # @param [Integer] user_limit The user limit of the channel.
172
+ # @param [Integer] position The position of the channel.
173
+ # @param [Hash{Discorb::Role, Discorb::Member => Discorb::PermissionOverwrite}] permission_overwrites
174
+ # A list of permission overwrites.
175
+ # @param [Discorb::CategoryChannel] parent The parent of the channel.
176
+ # @param [String] reason The reason for creating the channel.
177
+ #
178
+ # @return [Async::Task<Discorb::VoiceChannel>] The created voice channel.
179
+ def create_voice_channel: (
180
+ String name,
181
+ ?bitrate: Integer,
182
+ ?user_limit: Integer?,
183
+ ?position: Integer?,
184
+ ?permission_overwrites: Hash[(Discorb::Role
185
+ | Discorb::Member), Discorb::PermissionOverwrite]?,
186
+ ?parent: Discorb::CategoryChannel?,
187
+ ?reason: String?
188
+ ) -> Async::Task[Discorb::VoiceChannel]
189
+
190
+ # Create a new category channel.
191
+ # @async
192
+ #
193
+ # @param [String] name The name of the channel.
194
+ # @param [Integer] position The position of the channel.
195
+ # @param [Hash{Discorb::Role, Discorb::Member => Discorb::PermissionOverwrite}] permission_overwrites
196
+ # A list of permission overwrites.
197
+ # @param [Discorb::CategoryChannel] parent The parent of the channel.
198
+ # @param [String] reason The reason for creating the channel.
199
+ #
200
+ # @return [Async::Task<Discorb::CategoryChannel>] The created category channel.
201
+ def create_category_channel: (
202
+ String name,
203
+ ?position: Integer?,
204
+ ?permission_overwrites: Hash[(Discorb::Role
205
+ | Discorb::Member), Discorb::PermissionOverwrite]?,
206
+ ?parent: Discorb::CategoryChannel?,
207
+ ?reason: String?
208
+ ) -> Async::Task[Discorb::CategoryChannel]
209
+
210
+ #
211
+ # Create a new stage channel.
212
+ # @async
213
+ #
214
+ # @param [String] name The name of the channel.
215
+ # @param [Integer] bitrate The bitrate of the channel.
216
+ # @param [Integer] position The position of the channel.
217
+ # @param [Hash{Discorb::Role, Discorb::Member => Discorb::PermissionOverwrite}] permission_overwrites
218
+ # A list of permission overwrites.
219
+ # @param [Discorb::CategoryChannel] parent The parent of the channel.
220
+ # @param [String] reason The reason for creating the channel.
221
+ #
222
+ # @return [Async::Task<Discorb::StageChannel>] The created stage channel.
223
+ def create_stage_channel: (
224
+ String name,
225
+ ?bitrate: Integer,
226
+ ?position: Integer?,
227
+ ?permission_overwrites: Hash[(Discorb::Role
228
+ | Discorb::Member), Discorb::PermissionOverwrite]?,
229
+ ?parent: Discorb::CategoryChannel?,
230
+ ?reason: String?
231
+ ) -> Async::Task[Discorb::StageChannel]
232
+
233
+ #
234
+ # Create a new news channel.
235
+ # @async
236
+ #
237
+ # @param [String] name The name of the channel.
238
+ # @param [String] topic The topic of the channel.
239
+ # @param [Integer] rate_limit_per_user The rate limit per user in the channel.
240
+ # @param [Integer] slowmode Alias for `rate_limit_per_user`.
241
+ # @param [Integer] position The position of the channel.
242
+ # @param [Boolean] nsfw Whether the channel is nsfw.
243
+ # @param [Hash{Discorb::Role, Discorb::Member => Discorb::PermissionOverwrite}] permission_overwrites
244
+ # A list of permission overwrites.
245
+ # @param [Discorb::CategoryChannel] parent The parent of the channel.
246
+ # @param [String] reason The reason for creating the channel.
247
+ #
248
+ # @return [Async::Task<Discorb::NewsChannel>] The created news channel.
249
+ def create_news_channel: (
250
+ String name,
251
+ ?topic: String?,
252
+ ?rate_limit_per_user: Integer?,
253
+ ?slowmode: Integer?,
254
+ ?position: Integer?,
255
+ ?nsfw: bool?,
256
+ ?permission_overwrites: Hash[(Discorb::Role
257
+ | Discorb::Member), Discorb::PermissionOverwrite]?,
258
+ ?parent: Discorb::CategoryChannel?,
259
+ ?reason: String?
260
+ ) -> Async::Task[Discorb::NewsChannel]
261
+
262
+ #
263
+ # Fetch a list of active threads in the guild.
264
+ # @async
265
+ #
266
+ # @return [Async::Task<Array<Discorb::ThreadChannel>>] The list of threads.
267
+ def fetch_active_threads: -> Async::Task[::Array[Discorb::ThreadChannel]]
268
+
269
+ #
270
+ # Fetch a member in the guild.
271
+ # @async
272
+ #
273
+ # @param [#to_s] id The ID of the member to fetch.
274
+ #
275
+ # @return [Async::Task<Discorb::Member>] The member.
276
+ # @return [Async::Task<nil>] If the member is not found.
277
+ def fetch_member: (_ToS id) -> Async::Task[Discorb::Member]
278
+
279
+ # Fetch members in the guild.
280
+ # @async
281
+ # @macro members_intent
282
+ #
283
+ # @param [Integer] limit The maximum number of members to fetch, 0 for all.
284
+ # @param [Integer] after The ID of the member to start fetching after.
285
+ #
286
+ # @return [Async::Task<Array<Discorb::Member>>] The list of members.
287
+ def fetch_members: (
288
+ ?limit: Integer,
289
+ ?after: Integer?
290
+ ) -> Async::Task[::Array[Discorb::Member]]
291
+
292
+ #
293
+ # Search for members by name in the guild.
294
+ # @async
295
+ #
296
+ # @param [String] name The name of the member to search for.
297
+ # @param [Integer] limit The maximum number of members to return.
298
+ #
299
+ # @return [Async::Task<Array<Discorb::Member>>] The list of members.
300
+ def fetch_members_named: (
301
+ String name,
302
+ ?limit: Integer
303
+ ) -> Async::Task[::Array[Discorb::Member]]
304
+
305
+ #
306
+ # Almost the same as {#fetch_members_named}, but returns a single member.
307
+ # @async
308
+ #
309
+ # @return [Async::Task<Discorb::Member>] The member.
310
+ # @return [Async::Task<nil>] If the member is not found.
311
+ def fetch_member_named: -> Async::Task[Discorb::Member]
312
+
313
+ #
314
+ # Change nickname of client member.
315
+ # @async
316
+ #
317
+ # @param [String] nickname The nickname to set.
318
+ # @param [String] reason The reason for changing the nickname.
319
+ #
320
+ # @return [Async::Task<void>] The task.
321
+ def edit_nickname: (String nickname, ?reason: String?) -> Async::Task[void]
322
+
323
+ #
324
+ # Kick a member from the guild.
325
+ # @async
326
+ #
327
+ # @param [Discorb::Member] member The member to kick.
328
+ # @param [String] reason The reason for kicking the member.
329
+ #
330
+ # @return [Async::Task<void>] The task.
331
+ def kick_member: (
332
+ Discorb::Member member,
333
+ ?reason: String?
334
+ ) -> Async::Task[void]
335
+
336
+ #
337
+ # Fetch a list of bans in the guild.
338
+ # @async
339
+ #
340
+ # @param [Integer] limit The number of bans to fetch.
341
+ # @param [Discorb::Snowflake] before The ID of the ban to fetch before.
342
+ # @param [Discorb::Snowflake] after The ID of the ban to fetch after.
343
+ # @param [Discorb::Snowflake] around The ID of the ban to fetch around.
344
+ #
345
+ # @return [Async::Task<Array<Discorb::Guild::Ban>>] The list of bans.
346
+ def fetch_bans: (
347
+ ?Integer limit,
348
+ ?before: Discorb::Snowflake?,
349
+ ?after: Discorb::Snowflake?,
350
+ ?around: Discorb::Snowflake?
351
+ ) -> Async::Task[::Array[Discorb::Guild::Ban]]
352
+
353
+ #
354
+ # Fetch a ban in the guild.
355
+ # @async
356
+ #
357
+ # @param [Discorb::User] user The user to fetch.
358
+ #
359
+ # @return [Async::Task<Discorb::Guild::Ban>] The ban.
360
+ # @return [Async::Task<nil>] If the ban is not found.
361
+ def fetch_ban: (Discorb::User user) -> Async::Task[Discorb::Guild::Ban]
362
+
363
+ #
364
+ # Checks the user was banned from the guild.
365
+ # @async
366
+ #
367
+ # @param [Discorb::User] user The user to check.
368
+ #
369
+ # @return [Async::Task<Boolean>] Whether the user was banned.
370
+ def banned?: (Discorb::User user) -> Async::Task[bool]
371
+
372
+ #
373
+ # Ban a member from the guild.
374
+ # @async
375
+ #
376
+ # @param [Discorb::Member] member The member to ban.
377
+ # @param [Integer] delete_message_days The number of days to delete messages.
378
+ # @param [String] reason The reason for banning the member.
379
+ #
380
+ # @return [Async::Task<Discorb::Guild::Ban>] The ban.
381
+ def ban_member: (
382
+ Discorb::Member member,
383
+ ?delete_message_days: Integer,
384
+ ?reason: String?
385
+ ) -> Async::Task[Discorb::Guild::Ban]
386
+
387
+ #
388
+ # Unban a user from the guild.
389
+ # @async
390
+ #
391
+ # @param [Discorb::User] user The user to unban.
392
+ # @param [String] reason The reason for unbanning the user.
393
+ #
394
+ # @return [Async::Task<void>] The task.
395
+ def unban_user: (Discorb::User user, ?reason: String?) -> Async::Task[void]
396
+
397
+ #
398
+ # Fetch a list of roles in the guild.
399
+ # @async
400
+ #
401
+ # @return [Async::Task<Array<Discorb::Role>>] The list of roles.
402
+ def fetch_roles: -> Async::Task[::Array[Discorb::Role]]
403
+
404
+ #
405
+ # Create a role in the guild.
406
+ # @async
407
+ #
408
+ # @param [String] name The name of the role.
409
+ # @param [Discorb::Color] color The color of the role.
410
+ # @param [Boolean] hoist Whether the role should be hoisted.
411
+ # @param [Boolean] mentionable Whether the role should be mentionable.
412
+ # @param [String] reason The reason for creating the role.
413
+ #
414
+ # @return [Async::Task<Discorb::Role>] The role.
415
+ def create_role: (
416
+ ?String? name,
417
+ ?color: Discorb::Color?,
418
+ ?hoist: bool?,
419
+ ?mentionable: bool?,
420
+ ?reason: String?
421
+ ) -> Async::Task[Discorb::Role]
422
+
423
+ #
424
+ # Fetch how many members will be pruned.
425
+ # @async
426
+ #
427
+ # @param [Integer] days The number of days to prune.
428
+ # @param [Array<Discorb::Role>] roles The roles that include for pruning.
429
+ #
430
+ # @return [Async::Task<Integer>] The number of members that will be pruned.
431
+ def fetch_prune: (
432
+ ?Integer days,
433
+ ?roles: ::Array[Discorb::Role]
434
+ ) -> Async::Task[Integer]
435
+
436
+ #
437
+ # Prune members from the guild.
438
+ # @async
439
+ #
440
+ # @param [Integer] days The number of days to prune.
441
+ # @param [Array<Discorb::Role>] roles The roles that include for pruning.
442
+ # @param [String] reason The reason for pruning.
443
+ #
444
+ # @return [Async::Task<Integer>] The number of members that were pruned.
445
+ def prune: (
446
+ ?Integer days,
447
+ ?roles: ::Array[Discorb::Role],
448
+ ?reason: String?
449
+ ) -> Async::Task[Integer]
450
+
451
+ #
452
+ # Fetch voice regions that are available in the guild.
453
+ # @async
454
+ #
455
+ # @return [Async::Task<Array<Discorb::VoiceRegion>>] The available voice regions.
456
+ def fetch_voice_regions: -> Async::Task[::Array[Discorb::VoiceRegion]]
457
+
458
+ #
459
+ # Fetch invites in the guild.
460
+ # @async
461
+ #
462
+ # @return [Async::Task<Array<Invite>>] The invites.
463
+ def fetch_invites: -> Async::Task[::Array[Invite]]
464
+
465
+ #
466
+ # Fetch integrations in the guild.
467
+ # @async
468
+ #
469
+ # @return [Async::Task<Array<Discorb::Integration>>] The integrations.
470
+ def fetch_integrations: -> Async::Task[::Array[Discorb::Integration]]
471
+
472
+ #
473
+ # Fetch the widget of the guild.
474
+ # @async
475
+ #
476
+ # @return [Async::Task<Discorb::Guild::Widget>] The widget.
477
+ def fetch_widget: -> Async::Task[Discorb::Guild::Widget]
478
+
479
+ #
480
+ # Fetch the vanity URL of the guild.
481
+ # @async
482
+ #
483
+ # @return [Async::Task<Discorb::Guild::VanityInvite>] The vanity URL.
484
+ def fetch_vanity_invite: -> Async::Task[Discorb::Guild::VanityInvite]
485
+
486
+ #
487
+ # Fetch the welcome screen of the guild.
488
+ # @async
489
+ #
490
+ # @return [Async::Task<Discorb::WelcomeScreen>] The welcome screen.
491
+ def fetch_welcome_screen: -> Async::Task[Discorb::WelcomeScreen]
492
+
493
+ #
494
+ # Fetch stickers in the guild.
495
+ # @async
496
+ #
497
+ # @return [Async::Task<Array<Discorb::Sticker::GuildSticker>>] The stickers.
498
+ def fetch_stickers: -> Async::Task[::Array[Discorb::Sticker::GuildSticker]]
499
+
500
+ #
501
+ # Fetch the sticker by ID.
502
+ # @async
503
+ #
504
+ # @param [#to_s] id The ID of the sticker.
505
+ #
506
+ # @return [Async::Task<Discorb::Sticker::GuildSticker>] The sticker.
507
+ # @return [Async::Task<nil>] If the sticker does not exist.
508
+ def fetch_sticker: (_ToS id) -> Async::Task[Discorb::Sticker::GuildSticker]
509
+
510
+ #
511
+ # Fetch templates in the guild.
512
+ # @async
513
+ #
514
+ # @return [Async::Task<Discorb::GuildTemplate>] The templates.
515
+ def fetch_templates: -> Async::Task[Discorb::GuildTemplate]
516
+
517
+ #
518
+ # Almost the same as {#fetch_templates}, but returns a single template.
519
+ #
520
+ # @return [Discorb::GuildTemplate] The template.
521
+ # @return [Async::Task<nil>] If the template does not exist.
522
+ def fetch_template: -> Discorb::GuildTemplate
523
+
524
+ #
525
+ # Create a new template in the guild.
526
+ #
527
+ # @param [String] name The name of the template.
528
+ # @param [String] description The description of the template.
529
+ # @param [String] reason The reason for creating the template.
530
+ #
531
+ # @return [Async::Task<Discorb::GuildTemplate>] The template.
532
+ def create_template: (
533
+ String name,
534
+ ?String? description,
535
+ ?reason: String?
536
+ ) -> Async::Task[Discorb::GuildTemplate]
537
+
538
+ #
539
+ # Returns a banner url from the guild's ID.
540
+ #
541
+ # @param [#to_s] guild_id The ID of the guild.
542
+ # @param [:shield, :banner1, :banner2, :banner3, :banner4] style The style of the banner.
543
+ #
544
+ # @return [String] The url of the banner.
545
+ def self.banner: (_ToS guild_id, ?style: Symbol) -> String
546
+
547
+ #
548
+ # Returns text channels.
549
+ #
550
+ # @return [Array<Discorb::TextChannel>] The text channels.
551
+ def text_channels: -> ::Array[Discorb::TextChannel]
552
+
553
+ #
554
+ # Returns voice channels.
555
+ #
556
+ # @return [Array<Discorb::VoiceChannel>] The voice channels.
557
+ def voice_channels: -> ::Array[Discorb::VoiceChannel]
558
+
559
+ #
560
+ # Returns news channels.
561
+ #
562
+ # @return [Array<Discorb::NewsChannel>] The news channels.
563
+ def news_channels: -> ::Array[Discorb::NewsChannel]
564
+
565
+ #
566
+ # Returns stage channels.
567
+ #
568
+ # @return [Array<Discorb::StageChannel>] The stage channels.
569
+ def stage_channels: -> ::Array[Discorb::StageChannel]
570
+
571
+ #
572
+ # Create a new automod rule in the guild.
573
+ # @async
574
+ #
575
+ # @param [String] name The name of the rule.
576
+ # @param [Symbol] trigger_type The trigger type of the rule. See {Discorb::AutoModRule::TRIGGER_TYPES}.
577
+ # @param [Array<Discorb::AutoModRule::Action>] actions The actions of the rule.
578
+ # @param [Symbol] event_type The event type of the rule. See {Discorb::AutoModRule::EVENT_TYPES}.
579
+ # @param [Boolean] enabled Whether the rule is enabled or not.
580
+ # @param [Array<Discorb::Role>] exempt_roles The roles that are exempt from the rule.
581
+ # @param [Array<Discorb::Channel>] exempt_channels The channels that are exempt from the rule.
582
+ # @param [Array<String>] keyword_filter The keywords to filter.
583
+ # @param [Symbol] presets The preset of the rule. See {Discorb::AutoModRule::PRESET_TYPES}.
584
+ # @param [String] reason The reason for creating the rule.
585
+ #
586
+ # @return [Async::Task<Discorb::AutoModRule>] The automod rule.
587
+ def create_automod_rule: (
588
+ String name,
589
+ Discorb::AutoModRule::trigger_type trigger_type,
590
+ Array[Discorb::AutoModRule::Action] actions,
591
+ ?:send_message event_type,
592
+ ?enabled: bool,
593
+ ?exempt_roles: Array[Discorb::Role],
594
+ ?exempt_channels: Array[Discorb::Channel],
595
+ ?keyword_filter: Array[String]?,
596
+ ?presets: :profanity | :sexual_content | :slurs,
597
+ ?reason: nil
598
+ ) -> Async::Task[void]
599
+
600
+ # @return [Discorb::Snowflake] ID of the guild.
601
+ attr_reader id: Discorb::Snowflake
602
+
603
+ # @return [String] The name of the guild.
604
+ attr_reader name: String
605
+
606
+ # @return [Discorb::Asset] The splash of the guild.
607
+ attr_reader splash: Discorb::Asset
608
+
609
+ # @return [Discorb::Asset] The discovery splash of the guild.
610
+ attr_reader discovery_splash: Discorb::Asset
611
+
612
+ # @return [Discorb::Snowflake] ID of the guild owner.
613
+ attr_reader owner_id: Discorb::Snowflake
614
+
615
+ # @return [Discorb::Permission] The bot's permission in the guild.
616
+ attr_reader permissions: Discorb::Permission
617
+
618
+ # @return [Integer] The AFK timeout of the guild.
619
+ attr_reader afk_timeout: Integer
620
+
621
+ # @return [Discorb::Dictionary{Discorb::Snowflake => Discorb::Role}] A dictionary of roles in the guild.
622
+ attr_reader roles: Discorb::Dictionary[Discorb::Snowflake, Discorb::Role]
623
+
624
+ # @return [Discorb::Dictionary{Discorb::Snowflake => Discorb::CustomEmoji}]
625
+ # A dictionary of custom emojis in the guild.
626
+ attr_reader emojis: Discorb::Dictionary[Discorb::Snowflake, Discorb::CustomEmoji]
627
+
628
+ # @return [Array<Symbol>] features that are enabled in the guild.
629
+ # @see https://discord.com/developers/docs/resources/guild#guild-object-guild-features Official Discord API docs
630
+ attr_reader features: ::Array[Symbol]
631
+
632
+ # @return [:none, :elevated] The MFA level of the guild.
633
+ attr_reader mfa_level: Symbol
634
+
635
+ # @return [Discorb::SystemChannelFlag] The flag for the system channel.
636
+ attr_reader system_channel_flags: Discorb::SystemChannelFlag
637
+
638
+ # @return [Time] Time that representing when bot has joined the guild.
639
+ attr_reader joined_at: Time
640
+
641
+ # @return [Boolean] Whether the guild is unavailable.
642
+ attr_reader unavailable: bool
643
+
644
+ # @return [Integer] The amount of members in the guild.
645
+ attr_reader member_count: Integer
646
+
647
+ # @return [Discorb::Asset] The icon of the guild.
648
+ attr_reader icon: Discorb::Asset
649
+
650
+ # @return [Discorb::Dictionary{Discorb::User => Discorb::VoiceState}] A dictionary of voice states in the guild.
651
+ attr_reader voice_states: Discorb::Dictionary[Discorb::User, Discorb::VoiceState]
652
+
653
+ # @return [Discorb::Dictionary{Discorb::Snowflake => Discorb::Member}] A dictionary of members in the guild.
654
+ # @macro members_intent
655
+ attr_reader members: Discorb::Dictionary[Discorb::Snowflake, Discorb::Member]
656
+
657
+ # @return [Discorb::Dictionary{Discorb::Snowflake => Discorb::GuildChannel}] A dictionary of channels in the guild.
658
+ attr_reader channels: Discorb::Dictionary[Discorb::Snowflake, Discorb::GuildChannel]
659
+
660
+ # @return [Discorb::Dictionary{Discorb::Snowflake => Discorb::ThreadChannel}] A dictionary of threads in the guild.
661
+ attr_reader threads: Discorb::Dictionary[Discorb::Snowflake, Discorb::ThreadChannel]
662
+
663
+ # @return [Discorb::Dictionary{Discorb::User => Discorb::Presence}] A dictionary of presence in the guild.
664
+ attr_reader presences: Discorb::Dictionary[Discorb::User, Discorb::Presence]
665
+
666
+ # @return [Integer] Number of online members in the guild.
667
+ attr_reader max_presences: Integer
668
+
669
+ # @return [String] The vanity invite URL for the guild.
670
+ # @return [nil] If the guild does not have a vanity invite URL.
671
+ attr_reader vanity_url_code: String?
672
+
673
+ # @return [String] The description of the guild.
674
+ attr_reader description: String
675
+
676
+ # @return [Discorb::Asset] The banner of the guild.
677
+ # @return [nil] If the guild does not have a banner.
678
+ attr_reader banner: Discorb::Asset?
679
+
680
+ # @return [Integer] The premium tier (Boost Level) of the guild.
681
+ attr_reader premium_tier: Integer
682
+
683
+ # @return [Integer] The amount of premium subscriptions (Server Boosts) the guild has.
684
+ attr_reader premium_subscription_count: Integer
685
+
686
+ # @return [Symbol] The preffered language of the guild.
687
+ # @note This modifies the language code, `-` will be replaced with `_`.
688
+ attr_reader preferred_locale: Symbol
689
+
690
+ # @return [Integer] The maximum amount of users in a video channel.
691
+ attr_reader max_video_channel_users: Integer
692
+
693
+ # @return [Integer] The approxmate amount of members in the guild.
694
+ attr_reader approximate_member_count: Integer
695
+
696
+ # @return [Integer] The approxmate amount of non-offline members in the guild.
697
+ attr_reader approximate_presence_count: Integer
698
+
699
+ # @return [Discorb::WelcomeScreen] The welcome screen of the guild.
700
+ attr_reader welcome_screen: Discorb::WelcomeScreen?
701
+
702
+ # @return [:default, :explicit, :safe, :age_restricted] The nsfw level of the guild.
703
+ attr_reader nsfw_level: Symbol
704
+
705
+ # @return [Discorb::Dictionary{Discorb::Snowflake => Discorb::StageInstance}]
706
+ # A dictionary of stage instances in the guild.
707
+ attr_reader stage_instances: Discorb::Dictionary[Discorb::Snowflake, Discorb::StageInstance]
708
+
709
+ # @return [:none, :low, :medium, :high, :very_high] The verification level of the guild.
710
+ attr_reader verification_level: Symbol
711
+
712
+ # @return [:all_messages, :only_mentions] The default message notification level of the guild.
713
+ attr_reader default_message_notifications: Symbol
714
+
715
+ # @return [:disabled_in_text, :members_without_roles, :all_members] The explict content filter level of the guild.
716
+ attr_reader explicit_content_filter: Symbol
717
+
718
+ # @return [Boolean] Whether the client is the owner of the guild.
719
+ attr_reader owner: bool
720
+
721
+ # @return [Boolean] Whether the guild is large.
722
+ attr_reader large: bool
723
+
724
+ # @return [Boolean] Whether the guild enabled the widget.
725
+ attr_reader widget_enabled: bool
726
+
727
+ # @return [Boolean] Whether the guild is available.
728
+ attr_reader available: bool
729
+
730
+ # @return [Dictionary{Discorb::Snowflake => Discorb::ScheduledEvent}] A dictionary of scheduled events in the guild.
731
+ attr_reader scheduled_events: Dictionary[Discorb::Snowflake, Discorb::ScheduledEvent]
732
+
733
+ # @return [Discorb::VoiceChannel] The AFK channel for this guild.
734
+ # @macro client_cache
735
+ attr_reader afk_channel: Discorb::VoiceChannel?
736
+
737
+ # @return [Discorb::TextChannel] The system message channel for this guild.
738
+ # @macro client_cache
739
+ attr_reader system_channel: Discorb::TextChannel?
740
+
741
+ # @return [Discorb::TextChannel] The rules channel for this guild.
742
+ # @macro client_cache
743
+ attr_reader rules_channel: Discorb::TextChannel?
744
+
745
+ # @return [Discorb::TextChannel] The public updates channel (`#moderator-only`) for this guild.
746
+ # @macro client_cache
747
+ attr_reader public_updates_channel: Discorb::TextChannel?
748
+
749
+ # @return [Discorb::Member] The client's member in the guild.
750
+ attr_reader me: Discorb::Member
751
+
752
+ #
753
+ # Represents a vanity invite.
754
+ class VanityInvite < Discorb::DiscordModel
755
+ #
756
+ # Initialize a new instance of the {VanityInvite} class.
757
+ # @private
758
+ #
759
+ # @param [Discorb::Client] client The client.
760
+ # @param [Discorb::Guild] guild The guild.
761
+ # @param [Hash] data The data of the invite.
762
+ def initialize: (
763
+ Discorb::Client client,
764
+ Discorb::Guild guild,
765
+ Discorb::json data
766
+ ) -> void
767
+
768
+ # @return [String] The vanity invite code.
769
+ attr_reader code: String
770
+
771
+ # @return [Integer] The number of uses.
772
+ attr_reader uses: Integer
773
+
774
+ # @return [String] The vanity URL.
775
+ attr_reader url: String
776
+ end
777
+
778
+ #
779
+ # Represents a guild widget.
780
+ class Widget < Discorb::DiscordModel
781
+ #
782
+ # Initialize a new instance of the {Widget} class.
783
+ # @private
784
+ #
785
+ # @param [Discorb::Client] client The client.
786
+ # @param [Discorb::Snowflake] guild_id The guild ID.
787
+ # @param [Hash] data The data from Discord.
788
+ def initialize: (
789
+ Discorb::Client client,
790
+ Discorb::Snowflake guild_id,
791
+ Discorb::json data
792
+ ) -> void
793
+
794
+ #
795
+ # Edit the widget.
796
+ # @async
797
+ # @macro edit
798
+ #
799
+ # @param [Boolean] enabled Whether the widget is enabled.
800
+ # @param [Discorb::GuildChannel] channel The channel.
801
+ # @param [String] reason The reason for editing the widget.
802
+ #
803
+ # @return [Async::Task<void>] The task.
804
+ def edit: (
805
+ ?enabled: bool?,
806
+ ?channel: Discorb::GuildChannel?,
807
+ ?reason: String?
808
+ ) -> Async::Task[void]
809
+
810
+ #
811
+ # Return iframe HTML of the widget.
812
+ #
813
+ # @param ["dark", "light"] theme The theme of the widget.
814
+ # @param [Integer] width The width of the widget.
815
+ # @param [Integer] height The height of the widget.
816
+ #
817
+ # @return [String] The iframe HTML.
818
+ def iframe: (
819
+ ?theme: "dark" | "light",
820
+ ?width: Integer,
821
+ ?height: Integer
822
+ ) -> String
823
+
824
+ # @return [Discorb::Snowflake] The guild ID.
825
+ attr_reader guild_id: Discorb::Snowflake
826
+
827
+ # @return [Discorb::Snowflake] The channel ID.
828
+ attr_reader channel_id: Discorb::Snowflake
829
+
830
+ # @return [Boolean] Whether the widget is enabled.
831
+ attr_reader enabled: bool
832
+
833
+ # @macro client_cache
834
+ # @return [Discorb::Channel] The channel.
835
+ attr_reader channel: Discorb::Channel?
836
+
837
+ # @macro client_cache
838
+ # @return [Discorb::Guild] The guild.
839
+ attr_reader guild: Discorb::Guild?
840
+
841
+ # @return [String] The JSON URL.
842
+ attr_reader json_url: String
843
+ end
844
+
845
+ #
846
+ # Represents a ban.
847
+ class Ban < Discorb::DiscordModel
848
+ #
849
+ # Initialize a new instance of the {Ban} class.
850
+ # @private
851
+ #
852
+ # @param [Discorb::Client] client The client.
853
+ # @param [Discorb::Guild] guild The guild.
854
+ # @param [Hash] data The data from Discord.
855
+ def initialize: (
856
+ Discorb::Client client,
857
+ Discorb::Guild guild,
858
+ Discorb::json data
859
+ ) -> void
860
+
861
+ def inspect: -> String
862
+
863
+ # @return [Discorb::User] The user.
864
+ attr_reader user: Discorb::User
865
+
866
+ # @return [String] The reason for the ban.
867
+ attr_reader reason: String
868
+ end
869
+ end
870
+ end