discorb 0.18.0 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build_version.yml +2 -2
- data/.rubocop.yml +12 -75
- data/Changelog.md +25 -0
- data/Gemfile +4 -4
- data/README.md +2 -1
- data/Rakefile +482 -459
- data/Steepfile +8 -6
- data/docs/application_command.md +1 -0
- data/docs/events.md +2 -2
- data/docs/voice_events.md +6 -6
- data/lib/discorb/allowed_mentions.rb +68 -72
- data/lib/discorb/app_command/command.rb +466 -394
- data/lib/discorb/app_command/common.rb +65 -25
- data/lib/discorb/app_command/handler.rb +304 -265
- data/lib/discorb/app_command.rb +5 -5
- data/lib/discorb/application.rb +198 -197
- data/lib/discorb/asset.rb +101 -101
- data/lib/discorb/attachment.rb +134 -119
- data/lib/discorb/audit_logs.rb +412 -385
- data/lib/discorb/automod.rb +279 -269
- data/lib/discorb/channel/base.rb +107 -108
- data/lib/discorb/channel/category.rb +32 -32
- data/lib/discorb/channel/container.rb +44 -44
- data/lib/discorb/channel/dm.rb +26 -28
- data/lib/discorb/channel/guild.rb +311 -246
- data/lib/discorb/channel/stage.rb +156 -140
- data/lib/discorb/channel/text.rb +430 -336
- data/lib/discorb/channel/thread.rb +374 -325
- data/lib/discorb/channel/voice.rb +85 -79
- data/lib/discorb/channel.rb +5 -5
- data/lib/discorb/client.rb +635 -623
- data/lib/discorb/color.rb +178 -182
- data/lib/discorb/common.rb +168 -164
- data/lib/discorb/components/button.rb +107 -106
- data/lib/discorb/components/select_menu.rb +157 -145
- data/lib/discorb/components/text_input.rb +103 -106
- data/lib/discorb/components.rb +68 -66
- data/lib/discorb/dictionary.rb +135 -135
- data/lib/discorb/embed.rb +404 -398
- data/lib/discorb/emoji.rb +309 -302
- data/lib/discorb/emoji_table.rb +16099 -8857
- data/lib/discorb/error.rb +131 -131
- data/lib/discorb/event.rb +360 -314
- data/lib/discorb/event_handler.rb +39 -39
- data/lib/discorb/exe/about.rb +17 -17
- data/lib/discorb/exe/irb.rb +72 -67
- data/lib/discorb/exe/new.rb +323 -315
- data/lib/discorb/exe/run.rb +69 -68
- data/lib/discorb/exe/setup.rb +57 -55
- data/lib/discorb/exe/show.rb +12 -12
- data/lib/discorb/extend.rb +25 -45
- data/lib/discorb/extension.rb +89 -83
- data/lib/discorb/flag.rb +126 -128
- data/lib/discorb/gateway.rb +984 -794
- data/lib/discorb/gateway_events.rb +670 -638
- data/lib/discorb/gateway_requests.rb +45 -48
- data/lib/discorb/guild.rb +2115 -1626
- data/lib/discorb/guild_template.rb +280 -241
- data/lib/discorb/http.rb +247 -232
- data/lib/discorb/image.rb +42 -42
- data/lib/discorb/integration.rb +169 -161
- data/lib/discorb/intents.rb +161 -163
- data/lib/discorb/interaction/autocomplete.rb +76 -62
- data/lib/discorb/interaction/command.rb +279 -224
- data/lib/discorb/interaction/components.rb +114 -104
- data/lib/discorb/interaction/modal.rb +36 -32
- data/lib/discorb/interaction/response.rb +379 -330
- data/lib/discorb/interaction/root.rb +271 -118
- data/lib/discorb/interaction.rb +5 -5
- data/lib/discorb/invite.rb +154 -153
- data/lib/discorb/member.rb +344 -311
- data/lib/discorb/message.rb +615 -544
- data/lib/discorb/message_meta.rb +197 -186
- data/lib/discorb/modules.rb +371 -290
- data/lib/discorb/permission.rb +305 -289
- data/lib/discorb/presence.rb +352 -346
- data/lib/discorb/rate_limit.rb +81 -76
- data/lib/discorb/reaction.rb +55 -54
- data/lib/discorb/role.rb +272 -240
- data/lib/discorb/shard.rb +76 -74
- data/lib/discorb/sticker.rb +193 -171
- data/lib/discorb/user.rb +205 -188
- data/lib/discorb/utils/colored_puts.rb +16 -16
- data/lib/discorb/utils.rb +12 -16
- data/lib/discorb/voice_state.rb +305 -281
- data/lib/discorb/webhook.rb +537 -507
- data/lib/discorb.rb +62 -56
- data/sig/discorb/activity.rbs +1 -0
- data/sig/discorb/allowed_mentions.rbs +1 -0
- data/sig/discorb/app_command/base.rbs +7 -1
- data/sig/discorb/application.rbs +6 -0
- data/sig/discorb/asset.rbs +2 -0
- data/sig/discorb/attachment.rbs +8 -0
- data/sig/discorb/audit_log.rbs +7 -0
- data/sig/discorb/automod.rbs +32 -6
- data/sig/discorb/avatar.rbs +1 -0
- data/sig/discorb/channel/base.rbs +8 -1
- data/sig/discorb/channel/category.rbs +1 -0
- data/sig/discorb/channel/container.rbs +4 -0
- data/sig/discorb/channel/stage.rbs +4 -0
- data/sig/discorb/channel/text.rbs +2 -2
- data/sig/discorb/channel/thread.rbs +11 -0
- data/sig/discorb/channel/voice.rbs +2 -0
- data/sig/discorb/client.rbs +21 -20
- data/sig/discorb/color.rbs +6 -0
- data/sig/discorb/component/base.rbs +1 -0
- data/sig/discorb/component/button.rbs +2 -0
- data/sig/discorb/component/select_menu.rbs +4 -0
- data/sig/discorb/component/text_input.rbs +1 -0
- data/sig/discorb/custom_emoji.rbs +5 -1
- data/sig/discorb/dictionary.rbs +2 -0
- data/sig/discorb/discord_model.rbs +2 -0
- data/sig/discorb/embed.rbs +7 -0
- data/sig/discorb/emoji.rbs +1 -0
- data/sig/discorb/event_handler.rbs +2 -1
- data/sig/discorb/extension.rbs +13 -12
- data/sig/discorb/flag.rbs +2 -0
- data/sig/discorb/gateway.rbs +5 -0
- data/sig/discorb/guild.rbs +8 -4
- data/sig/discorb/guild_template.rbs +1 -1
- data/sig/discorb/http.rbs +4 -1
- data/sig/discorb/image.rbs +2 -0
- data/sig/discorb/integration.rbs +1 -1
- data/sig/discorb/intents.rbs +4 -3
- data/sig/discorb/interaction/base.rbs +36 -0
- data/sig/discorb/interaction/message_component.rbs +1 -2
- data/sig/discorb/interaction/modal.rbs +1 -2
- data/sig/discorb/interaction/responder.rbs +49 -49
- data/sig/discorb/invite.rbs +1 -1
- data/sig/discorb/member.rbs +2 -0
- data/sig/discorb/message.rbs +8 -1
- data/sig/discorb/messageable.rbs +1 -4
- data/sig/discorb/partial_emoji.rbs +3 -0
- data/sig/discorb/permissions.rbs +7 -0
- data/sig/discorb/presence.rbs +2 -0
- data/sig/discorb/reaction.rbs +5 -1
- data/sig/discorb/role.rbs +7 -1
- data/sig/discorb/scheduled_event.rbs +2 -1
- data/sig/discorb/shard.rbs +2 -1
- data/sig/discorb/snowflake.rbs +2 -0
- data/sig/discorb/stage_instance.rbs +9 -3
- data/sig/discorb/sticker.rbs +1 -1
- data/sig/discorb/unicode_emoji.rbs +4 -0
- data/sig/discorb/user.rbs +24 -20
- data/sig/discorb/webhook.rbs +17 -6
- data/sig/discorb/welcome_screen.rbs +1 -0
- data/sig/override.rbs +2 -0
- metadata +3 -3
data/lib/discorb.rb
CHANGED
@@ -1,56 +1,62 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# A new wrapper for the Discorb API.
|
4
|
-
#
|
5
|
-
# @author sevenc-nanashi
|
6
|
-
module Discorb
|
7
|
-
#
|
8
|
-
# Method to define a macro for YARD.
|
9
|
-
# @private
|
10
|
-
#
|
11
|
-
# @!macro [new] async
|
12
|
-
# @note This is an asynchronous method, it will return a `Async::Task` object.
|
13
|
-
# Use `Async::Task#wait` to get the result.
|
14
|
-
#
|
15
|
-
# @!macro [new] client_cache
|
16
|
-
# @note This method returns an object from client cache. it will return `nil` if the object is not in cache.
|
17
|
-
# @return [nil] The object wasn't cached.
|
18
|
-
#
|
19
|
-
# @!macro members_intent
|
20
|
-
# @note You must enable `GUILD_MEMBERS` intent to use this method.
|
21
|
-
#
|
22
|
-
# @!macro edit
|
23
|
-
# @note The arguments of this method are defaultly set to `Discorb::Unset`.
|
24
|
-
# Specify value to set the value, if not don't specify or specify `Discorb::Unset`.
|
25
|
-
#
|
26
|
-
# @!macro http
|
27
|
-
# @note This method calls HTTP request.
|
28
|
-
# @raise [Discorb::HTTPError] HTTP request failed.
|
29
|
-
#
|
30
|
-
def macro
|
31
|
-
puts "Wow, You found the easter egg!\n"
|
32
|
-
red = "\e[31m"
|
33
|
-
reset = "\e[m"
|
34
|
-
puts <<~"EASTEREGG"
|
35
|
-
. #{red} #{reset}
|
36
|
-
| #{red} | #{reset}
|
37
|
-
__| | __ __ _ #{red} _ |__ #{reset}
|
38
|
-
/ | | (__ / / \\ #{red}|/ | \\ #{reset}
|
39
|
-
\\__| | __) \\__ \\_/ #{red}| |__/ #{reset}
|
40
|
-
|
41
|
-
Thank you for using this library!
|
42
|
-
EASTEREGG
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
require_order =
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# A new wrapper for the Discorb API.
|
4
|
+
#
|
5
|
+
# @author sevenc-nanashi
|
6
|
+
module Discorb
|
7
|
+
#
|
8
|
+
# Method to define a macro for YARD.
|
9
|
+
# @private
|
10
|
+
#
|
11
|
+
# @!macro [new] async
|
12
|
+
# @note This is an asynchronous method, it will return a `Async::Task` object.
|
13
|
+
# Use `Async::Task#wait` to get the result.
|
14
|
+
#
|
15
|
+
# @!macro [new] client_cache
|
16
|
+
# @note This method returns an object from client cache. it will return `nil` if the object is not in cache.
|
17
|
+
# @return [nil] The object wasn't cached.
|
18
|
+
#
|
19
|
+
# @!macro members_intent
|
20
|
+
# @note You must enable `GUILD_MEMBERS` intent to use this method.
|
21
|
+
#
|
22
|
+
# @!macro edit
|
23
|
+
# @note The arguments of this method are defaultly set to `Discorb::Unset`.
|
24
|
+
# Specify value to set the value, if not don't specify or specify `Discorb::Unset`.
|
25
|
+
#
|
26
|
+
# @!macro http
|
27
|
+
# @note This method calls HTTP request.
|
28
|
+
# @raise [Discorb::HTTPError] HTTP request failed.
|
29
|
+
#
|
30
|
+
def macro
|
31
|
+
puts "Wow, You found the easter egg!\n"
|
32
|
+
red = "\e[31m"
|
33
|
+
reset = "\e[m"
|
34
|
+
puts <<~"EASTEREGG"
|
35
|
+
. #{red} #{reset}
|
36
|
+
| #{red} | #{reset}
|
37
|
+
__| | __ __ _ #{red} _ |__ #{reset}
|
38
|
+
/ | | (__ / / \\ #{red}|/ | \\ #{reset}
|
39
|
+
\\__| | __) \\__ \\_/ #{red}| |__/ #{reset}
|
40
|
+
|
41
|
+
Thank you for using this library!
|
42
|
+
EASTEREGG
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
require_order =
|
47
|
+
%w[common flag dictionary error rate_limit http intents emoji_table modules] +
|
48
|
+
%w[channel/container message_meta allowed_mentions] +
|
49
|
+
%w[user member guild emoji channel embed message] +
|
50
|
+
%w[application audit_logs color components event event_handler automod] +
|
51
|
+
%w[
|
52
|
+
attachment
|
53
|
+
guild_template
|
54
|
+
image
|
55
|
+
integration
|
56
|
+
interaction
|
57
|
+
invite
|
58
|
+
permission
|
59
|
+
] + %w[presence reaction role sticker utils voice_state webhook] +
|
60
|
+
%w[gateway_requests gateway_events gateway app_command] +
|
61
|
+
%w[asset extension shard client extend]
|
62
|
+
require_order.each { |name| require_relative "discorb/#{name}.rb" }
|
data/sig/discorb/activity.rbs
CHANGED
@@ -35,7 +35,7 @@ module Discorb
|
|
35
35
|
choices: Hash[String, (String | Integer | Float)]?,
|
36
36
|
choices_localizations: Hash[String, Hash[(Symbol | String), String]]?,
|
37
37
|
channel_types: Array[Class]?,
|
38
|
-
autocomplete: ^(Discorb::CommandInteraction) -> Hash[String, String]?,
|
38
|
+
autocomplete: (^(Discorb::CommandInteraction) -> Hash[String, String])?,
|
39
39
|
range: Range[(Integer | Float)]?
|
40
40
|
}
|
41
41
|
type options = ::Hash[String, option]
|
@@ -83,6 +83,7 @@ module Discorb
|
|
83
83
|
# @private
|
84
84
|
#
|
85
85
|
# @return [Hash] The hash represents the object.
|
86
|
+
%a{pure}
|
86
87
|
def to_hash: -> Discorb::json
|
87
88
|
|
88
89
|
# @return [Hash{String => String}] The name of the command.
|
@@ -143,6 +144,7 @@ module Discorb
|
|
143
144
|
# Returns the commands name.
|
144
145
|
#
|
145
146
|
# @return [String] The name of the command.
|
147
|
+
%a{pure}
|
146
148
|
def to_s: -> String
|
147
149
|
|
148
150
|
#
|
@@ -150,6 +152,7 @@ module Discorb
|
|
150
152
|
# @private
|
151
153
|
#
|
152
154
|
# @return [Hash] The hash represents the object.
|
155
|
+
%a{pure}
|
153
156
|
def to_hash: -> Discorb::json
|
154
157
|
|
155
158
|
# @return [Hash{String => String}] The description of the command.
|
@@ -219,6 +222,7 @@ module Discorb
|
|
219
222
|
# Returns the command name.
|
220
223
|
#
|
221
224
|
# @return [String] The command name.
|
225
|
+
%a{pure}
|
222
226
|
def to_s: -> String
|
223
227
|
|
224
228
|
#
|
@@ -233,6 +237,7 @@ module Discorb
|
|
233
237
|
# @private
|
234
238
|
#
|
235
239
|
# @return [Hash] The hash represents the object.
|
240
|
+
%a{pure}
|
236
241
|
def to_hash: -> Discorb::json
|
237
242
|
|
238
243
|
# @return [Array<Discorb::ApplicationCommand::Command>] The subcommands of the command.
|
@@ -260,6 +265,7 @@ module Discorb
|
|
260
265
|
Discorb::Client client
|
261
266
|
) -> void
|
262
267
|
|
268
|
+
%a{pure}
|
263
269
|
def to_s: -> untyped
|
264
270
|
|
265
271
|
#
|
data/sig/discorb/application.rbs
CHANGED
@@ -10,6 +10,7 @@ module Discorb
|
|
10
10
|
# @param [Hash] data The data of the object.
|
11
11
|
def initialize: (Discorb::Client client, Discorb::json data) -> void
|
12
12
|
|
13
|
+
%a{pure}
|
13
14
|
def inspect: -> String
|
14
15
|
|
15
16
|
# @return [Discorb::Snowflake] The application's ID.
|
@@ -59,6 +60,7 @@ module Discorb
|
|
59
60
|
# | `1 << 17` | `:embedded` |
|
60
61
|
# | `1 << 18` | `:gateway_message_content` |
|
61
62
|
# | `1 << 19` | `:gateway_message_content_limited` |
|
63
|
+
# | `1 << 23` | `:application_command_badge` |
|
62
64
|
class Flag < Discorb::Flag
|
63
65
|
attr_accessor gateway_presence: bool
|
64
66
|
attr_accessor gateway_presence_limited: bool
|
@@ -68,6 +70,7 @@ module Discorb
|
|
68
70
|
attr_accessor embedded: bool
|
69
71
|
attr_accessor gateway_message_content: bool
|
70
72
|
attr_accessor gateway_message_content_limited: bool
|
73
|
+
attr_accessor application_command_badge: bool
|
71
74
|
end
|
72
75
|
|
73
76
|
#
|
@@ -85,8 +88,10 @@ module Discorb
|
|
85
88
|
# The team's owner.
|
86
89
|
#
|
87
90
|
# @return [Discorb::Application::Team::Member] The team's owner.
|
91
|
+
%a{pure}
|
88
92
|
def owner: -> Discorb::Application::Team::Member
|
89
93
|
|
94
|
+
%a{pure}
|
90
95
|
def inspect: -> String
|
91
96
|
|
92
97
|
# @return [Discorb::Snowflake] The team's ID.
|
@@ -111,6 +116,7 @@ module Discorb
|
|
111
116
|
|
112
117
|
def initialize: (untyped client, untyped team, untyped data) -> void
|
113
118
|
|
119
|
+
%a{pure}
|
114
120
|
def inspect: -> String
|
115
121
|
|
116
122
|
def ==: (untyped other) -> untyped
|
data/sig/discorb/asset.rbs
CHANGED
data/sig/discorb/attachment.rbs
CHANGED
@@ -24,8 +24,16 @@ module Discorb
|
|
24
24
|
# @private
|
25
25
|
def initialize_hash: (untyped data) -> untyped
|
26
26
|
|
27
|
+
%a{pure}
|
27
28
|
def inspect: -> String
|
28
29
|
|
30
|
+
#
|
31
|
+
# Convert the attachment to hash.
|
32
|
+
#
|
33
|
+
# @return [Hash] The action hash.
|
34
|
+
%a{pure}
|
35
|
+
def to_hash: -> Discorb::json
|
36
|
+
|
29
37
|
#
|
30
38
|
# Creates a new file from a hash.
|
31
39
|
# @private
|
data/sig/discorb/audit_log.rbs
CHANGED
@@ -7,6 +7,7 @@ module Discorb
|
|
7
7
|
# @private
|
8
8
|
def initialize: (untyped client, untyped data, untyped guild) -> void
|
9
9
|
|
10
|
+
%a{pure}
|
10
11
|
def inspect: -> String
|
11
12
|
|
12
13
|
#
|
@@ -50,6 +51,7 @@ module Discorb
|
|
50
51
|
# @return [nil] The change with the given key does not exist.
|
51
52
|
def []: (Symbol key) -> Discorb::AuditLog::Entry::Change
|
52
53
|
|
54
|
+
%a{pure}
|
53
55
|
def inspect: -> String
|
54
56
|
|
55
57
|
# @return [Discorb::Snowflake] The ID of the entry.
|
@@ -145,12 +147,14 @@ module Discorb
|
|
145
147
|
|
146
148
|
#
|
147
149
|
# Formats the changes into a string.
|
150
|
+
%a{pure}
|
148
151
|
def inspect: -> String
|
149
152
|
|
150
153
|
#
|
151
154
|
# Get keys of changes.
|
152
155
|
#
|
153
156
|
# @return [Array<Symbol>] The keys of the changes.
|
157
|
+
%a{pure}
|
154
158
|
def keys: -> ::Array[Symbol]
|
155
159
|
|
156
160
|
#
|
@@ -160,6 +164,7 @@ module Discorb
|
|
160
164
|
#
|
161
165
|
# @return [Discorb::AuditLog::Entry::Change] The change with the given key.
|
162
166
|
# @return [nil] The change with the given key does not exist.
|
167
|
+
%a{pure}
|
163
168
|
def []: (Symbol key) -> Discorb::AuditLog::Entry::Change
|
164
169
|
|
165
170
|
# Returns the value of attribute data.
|
@@ -183,6 +188,7 @@ module Discorb
|
|
183
188
|
# Format the change into a string.
|
184
189
|
#
|
185
190
|
# @return [String] The string representation of the change.
|
191
|
+
%a{pure}
|
186
192
|
def inspect: -> String
|
187
193
|
|
188
194
|
#
|
@@ -213,6 +219,7 @@ module Discorb
|
|
213
219
|
# @private
|
214
220
|
def initialize: (untyped data) -> void
|
215
221
|
|
222
|
+
%a{pure}
|
216
223
|
def inspect: -> String
|
217
224
|
|
218
225
|
# @return [Discorb::Snowflake] The ID of the integration.
|
data/sig/discorb/automod.rbs
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Discorb
|
2
2
|
class AutoModRule < DiscordModel
|
3
|
-
type trigger_type =
|
3
|
+
type trigger_type =
|
4
|
+
:keyword | :harmful_link | :spam | :keyword_preset | :mention_spam
|
4
5
|
type preset_type = :profanity | :sexual_content | :slurs
|
5
6
|
|
6
7
|
# @return [Hash{Integer => Symbol}] The mapping of trigger types.
|
@@ -28,26 +29,41 @@ module Discorb
|
|
28
29
|
# @return [Array<Discorb::AutoModRule::Action>] The actions of the rule.
|
29
30
|
attr_reader actions: Array[Discorb::AutoModRule::Action]
|
30
31
|
|
32
|
+
# @return [Array<String>] Substrings which will be exempt from triggering the preset trigger type.
|
33
|
+
# @note This is only available if the trigger type is `:keyword_preset`.
|
34
|
+
attr_reader allow_list: Array[String]?
|
35
|
+
|
31
36
|
# @return [Array<String>] The keywords that the rule is triggered by.
|
32
37
|
# @note This is only available if the trigger type is `:keyword`.
|
33
38
|
attr_reader keyword_filter: Array[String]?
|
34
39
|
|
40
|
+
# @return [Integer] Total number of mentions allowed per message.
|
41
|
+
# @note This is only available if the trigger type is `:mention_spam`.
|
42
|
+
attr_reader mention_total_limit: Integer?
|
43
|
+
|
35
44
|
# @return [Symbol] Returns the type of the preset.
|
36
45
|
# @note This is only available if the trigger type is `:keyword_preset`.
|
46
|
+
%a{pure}
|
37
47
|
def preset_type: -> preset_type
|
38
48
|
|
39
49
|
# @return [Symbol] Returns the type of the trigger.
|
50
|
+
%a{pure}
|
40
51
|
def trigger_type: -> trigger_type
|
41
52
|
|
42
53
|
# @return [Symbol] Returns the type of the event.
|
54
|
+
%a{pure}
|
43
55
|
def event_type: -> :message_send
|
44
56
|
|
57
|
+
%a{pure}
|
45
58
|
def creator: -> Discorb::Member
|
46
59
|
|
60
|
+
%a{pure}
|
47
61
|
def guild: -> Discorb::Guild
|
48
62
|
|
63
|
+
%a{pure}
|
49
64
|
def exempt_roles: -> Array[Discorb::Role]
|
50
65
|
|
66
|
+
%a{pure}
|
51
67
|
def exempt_channels: -> Array[Discorb::Channel]
|
52
68
|
|
53
69
|
#
|
@@ -76,7 +92,7 @@ module Discorb
|
|
76
92
|
# @return [Async::Task<void>] The task.
|
77
93
|
def edit: (
|
78
94
|
?name: String,
|
79
|
-
?event_type: :
|
95
|
+
?event_type: :message_send,
|
80
96
|
?actions: Array[Discorb::AutoModRule::Action],
|
81
97
|
?enabled: bool,
|
82
98
|
?exempt_roles: Array[Discorb::Role],
|
@@ -92,20 +108,29 @@ module Discorb
|
|
92
108
|
# @param [String] reason The reason for deleting the rule.
|
93
109
|
#
|
94
110
|
# @return [Async::Task<void>] The task.
|
95
|
-
def delete
|
111
|
+
def delete: (?reason: nil) -> Async::Task[void]
|
96
112
|
|
97
113
|
class Action < Discorb::DiscordModel
|
114
|
+
type action_type = :ban | :kick | :mute | :warn
|
115
|
+
|
98
116
|
# @return [Hash{Integer => Symbol}] The mapping of action types.
|
99
117
|
# @private
|
100
|
-
ACTION_TYPES: Hash[Integer,
|
118
|
+
ACTION_TYPES: Hash[Integer, action_type]
|
101
119
|
|
102
120
|
# @return [Symbol] Returns the type of the action.
|
103
|
-
attr_reader type:
|
121
|
+
attr_reader type: action_type
|
104
122
|
|
105
123
|
# @return [Integer] The duration of the timeout.
|
106
124
|
# @note This is only available if the action type is `:timeout`.
|
107
125
|
attr_reader duration_seconds: Integer?
|
108
126
|
|
127
|
+
#
|
128
|
+
# Convert the action to hash.
|
129
|
+
#
|
130
|
+
# @return [Hash] The action hash.
|
131
|
+
%a{pure}
|
132
|
+
def to_hash: -> Discorb::json
|
133
|
+
|
109
134
|
#
|
110
135
|
# Initialize a new action.
|
111
136
|
#
|
@@ -115,13 +140,14 @@ module Discorb
|
|
115
140
|
# @param [Discorb::Channel] channel The channel that the alert message is sent to.
|
116
141
|
# This is only available if the action type is `:send_alert_message`.
|
117
142
|
def initialize: (
|
118
|
-
|
143
|
+
action_type `type`,
|
119
144
|
?duration_seconds: Integer?,
|
120
145
|
?channel: Discorb::Channel?
|
121
146
|
) -> void
|
122
147
|
|
123
148
|
# @return [Discorb::Channel] The channel that the alert message is sent to.
|
124
149
|
# @note This is only available if the action type is `:send_alert_message`.
|
150
|
+
%a{pure}
|
125
151
|
def channel: -> Discorb::Channel?
|
126
152
|
end
|
127
153
|
end
|
data/sig/discorb/avatar.rbs
CHANGED
@@ -16,6 +16,7 @@ module Discorb
|
|
16
16
|
# @return [Boolean] True if the channel is other channel.
|
17
17
|
def ==: (Discorb::Channel other) -> bool
|
18
18
|
|
19
|
+
%a{pure}
|
19
20
|
def inspect: -> String
|
20
21
|
|
21
22
|
#
|
@@ -36,6 +37,7 @@ module Discorb
|
|
36
37
|
?no_cache: bool
|
37
38
|
) -> untyped
|
38
39
|
|
40
|
+
%a{pure}
|
39
41
|
def `type`: -> String
|
40
42
|
|
41
43
|
#
|
@@ -78,14 +80,19 @@ module Discorb
|
|
78
80
|
# Stringifies the channel.
|
79
81
|
#
|
80
82
|
# @return [String] The name of the channel with `#`.
|
83
|
+
%a{pure}
|
81
84
|
def to_s: -> String
|
82
85
|
|
86
|
+
%a{pure}
|
83
87
|
def mention: -> String
|
84
88
|
|
89
|
+
%a{pure}
|
85
90
|
def parent: -> Discorb::CategoryChannel?
|
86
91
|
|
92
|
+
%a{pure}
|
87
93
|
def guild: -> Discorb::Guild
|
88
94
|
|
95
|
+
%a{pure}
|
89
96
|
def inspect: -> String
|
90
97
|
|
91
98
|
#
|
@@ -95,7 +102,7 @@ module Discorb
|
|
95
102
|
# @param [String] reason The reason of deleting the channel.
|
96
103
|
#
|
97
104
|
# @return [Async::Task<self>] The deleted channel.
|
98
|
-
def delete
|
105
|
+
def delete: (?reason: String?) -> Async::Task[self]
|
99
106
|
|
100
107
|
#
|
101
108
|
# Moves the channel to another position.
|
@@ -6,24 +6,28 @@ module Discorb
|
|
6
6
|
# Returns text channels.
|
7
7
|
#
|
8
8
|
# @return [Array<Discorb::TextChannel>] The text channels.
|
9
|
+
%a{pure}
|
9
10
|
def text_channels: -> ::Array[Discorb::TextChannel]
|
10
11
|
|
11
12
|
#
|
12
13
|
# Returns voice channels.
|
13
14
|
#
|
14
15
|
# @return [Array<Discorb::VoiceChannel>] The voice channels.
|
16
|
+
%a{pure}
|
15
17
|
def voice_channels: -> ::Array[Discorb::VoiceChannel]
|
16
18
|
|
17
19
|
#
|
18
20
|
# Returns news channels.
|
19
21
|
#
|
20
22
|
# @return [Array<Discorb::NewsChannel>] The news channels.
|
23
|
+
%a{pure}
|
21
24
|
def news_channels: -> ::Array[Discorb::NewsChannel]
|
22
25
|
|
23
26
|
#
|
24
27
|
# Returns stage channels.
|
25
28
|
#
|
26
29
|
# @return [Array<Discorb::StageChannel>] The stage channels.
|
30
|
+
%a{pure}
|
27
31
|
def stage_channels: -> ::Array[Discorb::StageChannel]
|
28
32
|
end
|
29
33
|
end
|
@@ -54,12 +54,16 @@ module Discorb
|
|
54
54
|
# @return [Async::Task<nil>] If there is no current stage instance.
|
55
55
|
def fetch_stage_instance: -> Async::Task[StageInstance]
|
56
56
|
|
57
|
+
%a{pure}
|
57
58
|
def voice_states: -> Array[Discorb::VoiceState]
|
58
59
|
|
60
|
+
%a{pure}
|
59
61
|
def members: -> Array[Discorb::Member]
|
60
62
|
|
63
|
+
%a{pure}
|
61
64
|
def speakers: -> Array[Discorb::Member]
|
62
65
|
|
66
|
+
%a{pure}
|
63
67
|
def audiences: -> Array[Discorb::Member]
|
64
68
|
|
65
69
|
# @return [Integer] The bitrate of the voice channel.
|
@@ -34,7 +34,7 @@ module Discorb
|
|
34
34
|
?rate_limit_per_user: Integer,
|
35
35
|
?slowmode: Integer,
|
36
36
|
?default_auto_archive_duration: 60 | 1440 | 4320 | 10080,
|
37
|
-
?archive_in:
|
37
|
+
?archive_in: 60 | 1440 | 4320 | 10080,
|
38
38
|
?reason: String?
|
39
39
|
) -> Async::Task[self]
|
40
40
|
|
@@ -66,7 +66,7 @@ module Discorb
|
|
66
66
|
# @param [Boolean] force Whether to ignore the validation for message (14 days limit).
|
67
67
|
#
|
68
68
|
# @return [Async::Task<void>] The task.
|
69
|
-
def delete_messages
|
69
|
+
def delete_messages:
|
70
70
|
(*Discorb::Message messages, ?force: bool) -> Async::Task[void]
|
71
71
|
| (*Array[Discorb::Message] messages, ?force: bool) -> Async::Task[void]
|
72
72
|
|
@@ -79,16 +79,22 @@ module Discorb
|
|
79
79
|
# @note This method won't unarchive the thread. Use {#unarchive} instead.
|
80
80
|
def unlock: (?reason: String?) -> Async::Task[self]
|
81
81
|
|
82
|
+
%a{pure}
|
82
83
|
def parent: -> untyped
|
83
84
|
|
85
|
+
%a{pure}
|
84
86
|
def me: -> untyped
|
85
87
|
|
88
|
+
%a{pure}
|
86
89
|
def joined?: -> bool
|
87
90
|
|
91
|
+
%a{pure}
|
88
92
|
def guild: -> untyped
|
89
93
|
|
94
|
+
%a{pure}
|
90
95
|
def owner: -> untyped
|
91
96
|
|
97
|
+
%a{pure}
|
92
98
|
def inspect: -> String
|
93
99
|
|
94
100
|
#
|
@@ -168,14 +174,19 @@ module Discorb
|
|
168
174
|
_ToS guild_id
|
169
175
|
) -> void
|
170
176
|
|
177
|
+
%a{pure}
|
171
178
|
def thread: -> Discorb::ThreadChannel
|
172
179
|
|
180
|
+
%a{pure}
|
173
181
|
def member: -> Discorb::Member
|
174
182
|
|
183
|
+
%a{pure}
|
175
184
|
def id: -> Discorb::Snowflake
|
176
185
|
|
186
|
+
%a{pure}
|
177
187
|
def user: -> Discorb::User
|
178
188
|
|
189
|
+
%a{pure}
|
179
190
|
def inspect: -> String
|
180
191
|
|
181
192
|
# Returns the value of attribute joined_at.
|