discorb 0.18.1 → 0.19.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/Changelog.md +9 -0
- data/Gemfile +4 -4
- data/Rakefile +17 -22
- data/Steepfile +8 -6
- data/docs/events.md +2 -2
- data/docs/voice_events.md +6 -6
- data/lib/discorb/automod.rb +1 -1
- data/lib/discorb/channel/guild.rb +3 -3
- data/lib/discorb/channel/text.rb +3 -3
- data/lib/discorb/client.rb +4 -6
- data/lib/discorb/common.rb +1 -1
- data/lib/discorb/embed.rb +1 -1
- data/lib/discorb/emoji.rb +2 -2
- data/lib/discorb/event.rb +2 -2
- data/lib/discorb/gateway.rb +17 -7
- data/lib/discorb/guild.rb +4 -4
- data/lib/discorb/guild_template.rb +2 -2
- data/lib/discorb/integration.rb +2 -2
- data/lib/discorb/interaction/response.rb +83 -77
- data/lib/discorb/interaction/root.rb +136 -0
- data/lib/discorb/invite.rb +1 -1
- data/lib/discorb/message.rb +4 -4
- data/lib/discorb/modules.rb +2 -2
- data/lib/discorb/permission.rb +3 -1
- data/lib/discorb/role.rb +2 -2
- data/lib/discorb/shard.rb +1 -1
- data/lib/discorb/sticker.rb +2 -2
- data/lib/discorb/voice_state.rb +3 -3
- data/lib/discorb/webhook.rb +5 -5
- data/sig/discorb/activity.rbs +1 -0
- data/sig/discorb/allowed_mentions.rbs +1 -0
- data/sig/discorb/app_command/base.rbs +6 -0
- data/sig/discorb/application.rbs +4 -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 +22 -5
- 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 +6 -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 +33 -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 +6 -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 +2 -0
- data/sig/discorb/webhook.rbs +17 -6
- data/sig/discorb/welcome_screen.rbs +1 -0
- data/sig/override.rbs +2 -0
- metadata +3 -3
|
@@ -83,6 +83,142 @@ module Discorb
|
|
|
83
83
|
"#<#{self.class} id=#{@id}>"
|
|
84
84
|
end
|
|
85
85
|
|
|
86
|
+
#
|
|
87
|
+
# Send followup message.
|
|
88
|
+
#
|
|
89
|
+
# @async
|
|
90
|
+
#
|
|
91
|
+
# @param [String] content The content of the response.
|
|
92
|
+
# @param [Boolean] tts Whether to send the message as text-to-speech.
|
|
93
|
+
# @param [Discorb::Embed] embed The embed to send.
|
|
94
|
+
# @param [Array<Discorb::Embed>] embeds The embeds to send. (max: 10)
|
|
95
|
+
# @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions to send.
|
|
96
|
+
# @param [Discorb::Attachment] attachment The attachment to send.
|
|
97
|
+
# @param [Array<Discorb::Attachment>] attachments The attachments to send. (max: 10)
|
|
98
|
+
# @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
|
|
99
|
+
# @param [Boolean] ephemeral Whether to make the response ephemeral.
|
|
100
|
+
#
|
|
101
|
+
# @return [Discorb::Webhook::Message] The message.
|
|
102
|
+
#
|
|
103
|
+
def post(
|
|
104
|
+
content = nil,
|
|
105
|
+
tts: false,
|
|
106
|
+
embed: nil,
|
|
107
|
+
embeds: nil,
|
|
108
|
+
allowed_mentions: nil,
|
|
109
|
+
attachment: nil,
|
|
110
|
+
attachments: nil,
|
|
111
|
+
components: nil,
|
|
112
|
+
ephemeral: false
|
|
113
|
+
)
|
|
114
|
+
Async do
|
|
115
|
+
payload = {}
|
|
116
|
+
payload[:content] = content if content
|
|
117
|
+
payload[:tts] = tts
|
|
118
|
+
payload[:embeds] = (embeds || [embed]).map { |e| e&.to_hash }.filter { _1 }
|
|
119
|
+
payload[:allowed_mentions] =
|
|
120
|
+
allowed_mentions&.to_hash(@client.allowed_mentions) || @client.allowed_mentions.to_hash
|
|
121
|
+
payload[:components] = Component.to_payload(components) if components
|
|
122
|
+
payload[:flags] = (ephemeral ? 1 << 6 : 0)
|
|
123
|
+
attachments ||= attachment ? [attachment] : []
|
|
124
|
+
|
|
125
|
+
payload[:attachments] = attachments.map.with_index do |a, i|
|
|
126
|
+
{
|
|
127
|
+
id: i,
|
|
128
|
+
filename: a.filename,
|
|
129
|
+
description: a.description,
|
|
130
|
+
}
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
_resp, data = @client.http.multipart_request(
|
|
134
|
+
Route.new(
|
|
135
|
+
"/webhooks/#{@application_id}/#{@token}",
|
|
136
|
+
"//webhooks/:webhook_id/:token",
|
|
137
|
+
:post
|
|
138
|
+
),
|
|
139
|
+
payload,
|
|
140
|
+
attachments
|
|
141
|
+
).wait
|
|
142
|
+
webhook = Webhook::URLWebhook.new("/webhooks/#{@application_id}/#{@token}")
|
|
143
|
+
Webhook::Message.new(webhook, data, @client)
|
|
144
|
+
ret
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
#
|
|
149
|
+
# Edit the original response message.
|
|
150
|
+
# This method is low-level.
|
|
151
|
+
#
|
|
152
|
+
# @async
|
|
153
|
+
#
|
|
154
|
+
# @param [String] content The content of the response.
|
|
155
|
+
# @param [Discorb::Embed] embed The embed to send.
|
|
156
|
+
# @param [Array<Discorb::Embed>] embeds The embeds to send. (max: 10)
|
|
157
|
+
# @param [Discorb::AllowedMentions] allowed_mentions The allowed mentions to send.
|
|
158
|
+
# @param [Discorb::Attachment] attachment The attachment to send.
|
|
159
|
+
# @param [Array<Discorb::Attachment>] attachments The attachments to send. (max: 10)
|
|
160
|
+
# @param [Array<Discorb::Component>, Array<Array<Discorb::Component>>] components The components to send.
|
|
161
|
+
#
|
|
162
|
+
# @return [Async::Task<void>] The task.
|
|
163
|
+
#
|
|
164
|
+
# @see CallbackMessage#edit
|
|
165
|
+
#
|
|
166
|
+
def edit_original_message(
|
|
167
|
+
content = nil,
|
|
168
|
+
embed: nil,
|
|
169
|
+
embeds: nil,
|
|
170
|
+
attachment: nil,
|
|
171
|
+
attachments: nil,
|
|
172
|
+
components: nil
|
|
173
|
+
)
|
|
174
|
+
Async do
|
|
175
|
+
payload = {}
|
|
176
|
+
payload[:content] = content if content
|
|
177
|
+
payload[:embeds] = (embeds || [embed]).map { |e| e&.to_hash }.filter { _1 }.then { _1.empty? ? nil : _1 }
|
|
178
|
+
payload[:components] = Component.to_payload(components) if components
|
|
179
|
+
attachments ||= attachment && [attachment]
|
|
180
|
+
|
|
181
|
+
payload[:attachments] = attachments&.map&.with_index do |a, i|
|
|
182
|
+
{
|
|
183
|
+
id: i,
|
|
184
|
+
filename: a.filename,
|
|
185
|
+
description: a.description,
|
|
186
|
+
}
|
|
187
|
+
end
|
|
188
|
+
payload.compact!
|
|
189
|
+
|
|
190
|
+
@client.http.multipart_request(
|
|
191
|
+
Route.new(
|
|
192
|
+
"/webhooks/#{@application_id}/#{@token}/messages/@original",
|
|
193
|
+
"//webhooks/:webhook_id/:token/messages/@original",
|
|
194
|
+
:patch
|
|
195
|
+
),
|
|
196
|
+
payload,
|
|
197
|
+
attachments
|
|
198
|
+
).wait
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
#
|
|
203
|
+
# Delete the original response message.
|
|
204
|
+
# This method is low-level.
|
|
205
|
+
#
|
|
206
|
+
# @async
|
|
207
|
+
#
|
|
208
|
+
# @return [Async::Task<void>] The task.
|
|
209
|
+
#
|
|
210
|
+
def delete_original_message
|
|
211
|
+
Async do
|
|
212
|
+
@client.http.request(
|
|
213
|
+
Route.new(
|
|
214
|
+
"/webhooks/#{@application_id}/#{@token}/messages/@original",
|
|
215
|
+
"//webhooks/:webhook_id/:token/messages/@original",
|
|
216
|
+
:delete
|
|
217
|
+
)
|
|
218
|
+
).wait
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
86
222
|
class << self
|
|
87
223
|
# @private
|
|
88
224
|
attr_reader :interaction_type, :interaction_name, :event_name
|
data/lib/discorb/invite.rb
CHANGED
|
@@ -112,7 +112,7 @@ module Discorb
|
|
|
112
112
|
# @async
|
|
113
113
|
# @return [Async::Task<void>] The task.
|
|
114
114
|
#
|
|
115
|
-
def delete
|
|
115
|
+
def delete(reason: nil)
|
|
116
116
|
Async do
|
|
117
117
|
@client.http.request(Route.new("/invites/#{@code}", "//invites/:code", :delete), {}, audit_log_reason: reason)
|
|
118
118
|
end
|
data/lib/discorb/message.rb
CHANGED
|
@@ -282,9 +282,9 @@ module Discorb
|
|
|
282
282
|
#
|
|
283
283
|
# @return [Async::Task<void>] The task.
|
|
284
284
|
#
|
|
285
|
-
def delete
|
|
285
|
+
def delete(reason: nil)
|
|
286
286
|
Async do
|
|
287
|
-
channel.delete_message
|
|
287
|
+
channel.delete_message(@id, reason: reason).wait
|
|
288
288
|
end
|
|
289
289
|
end
|
|
290
290
|
|
|
@@ -408,10 +408,10 @@ module Discorb
|
|
|
408
408
|
#
|
|
409
409
|
# @return [Async::Task<Array<Discorb::User>>] The users.
|
|
410
410
|
#
|
|
411
|
-
def fetch_reacted_users(emoji, limit: nil, after: 0)
|
|
411
|
+
def fetch_reacted_users(emoji, limit: nil, after: Discorb::Snowflake.new("0"))
|
|
412
412
|
Async do
|
|
413
413
|
if limit.nil? || !limit.positive?
|
|
414
|
-
after = 0
|
|
414
|
+
after = Discorb::Snowflake.new("0")
|
|
415
415
|
users = []
|
|
416
416
|
loop do
|
|
417
417
|
_resp, data = @client.http.request(
|
data/lib/discorb/modules.rb
CHANGED
|
@@ -135,7 +135,7 @@ module Discorb
|
|
|
135
135
|
#
|
|
136
136
|
# @return [Async::Task<void>] The task.
|
|
137
137
|
#
|
|
138
|
-
def delete_message
|
|
138
|
+
def delete_message(message_id, reason: nil)
|
|
139
139
|
Async do
|
|
140
140
|
@client.http.request(
|
|
141
141
|
Route.new(
|
|
@@ -146,7 +146,7 @@ module Discorb
|
|
|
146
146
|
end
|
|
147
147
|
end
|
|
148
148
|
|
|
149
|
-
alias destroy_message
|
|
149
|
+
alias destroy_message delete_message
|
|
150
150
|
|
|
151
151
|
#
|
|
152
152
|
# Fetch a message from ID.
|
data/lib/discorb/permission.rb
CHANGED
|
@@ -202,7 +202,9 @@ module Discorb
|
|
|
202
202
|
def +(other)
|
|
203
203
|
result = to_hash
|
|
204
204
|
self.class.bits.each_key do |field|
|
|
205
|
-
|
|
205
|
+
unless other[field].nil?
|
|
206
|
+
result[field] = (other[field] || raise(KeyError, "field #{field} not found in #{other.inspect}"))
|
|
207
|
+
end
|
|
206
208
|
end
|
|
207
209
|
self.class.from_hash(result)
|
|
208
210
|
end
|
data/lib/discorb/role.rb
CHANGED
|
@@ -165,7 +165,7 @@ module Discorb
|
|
|
165
165
|
#
|
|
166
166
|
# @return [Async::Task<void>] The task.
|
|
167
167
|
#
|
|
168
|
-
def delete
|
|
168
|
+
def delete(reason: nil)
|
|
169
169
|
Async do
|
|
170
170
|
@client.http.request(
|
|
171
171
|
Route.new("/guilds/#{@guild.id}/roles/#{@id}", "//guilds/:guild_id/roles/:role_id",
|
|
@@ -174,7 +174,7 @@ module Discorb
|
|
|
174
174
|
end
|
|
175
175
|
end
|
|
176
176
|
|
|
177
|
-
alias destroy
|
|
177
|
+
alias destroy delete
|
|
178
178
|
|
|
179
179
|
def tag
|
|
180
180
|
Tag.new(@tags)
|
data/lib/discorb/shard.rb
CHANGED
data/lib/discorb/sticker.rb
CHANGED
|
@@ -100,7 +100,7 @@ module Discorb
|
|
|
100
100
|
#
|
|
101
101
|
# @param [String] reason The reason for the deletion.
|
|
102
102
|
#
|
|
103
|
-
def delete
|
|
103
|
+
def delete(reason: nil)
|
|
104
104
|
Async do
|
|
105
105
|
@client.http.request(
|
|
106
106
|
Route.new("/guilds/#{@guild_id}/stickers/#{@id}", "//guilds/:guild_id/stickers/:sticker_id",
|
|
@@ -109,7 +109,7 @@ module Discorb
|
|
|
109
109
|
end
|
|
110
110
|
end
|
|
111
111
|
|
|
112
|
-
alias destroy
|
|
112
|
+
alias destroy delete
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
#
|
data/lib/discorb/voice_state.rb
CHANGED
|
@@ -213,7 +213,7 @@ module Discorb
|
|
|
213
213
|
#
|
|
214
214
|
# @return [Async::Task<void>] The task.
|
|
215
215
|
#
|
|
216
|
-
def delete
|
|
216
|
+
def delete(reason: nil)
|
|
217
217
|
Async do
|
|
218
218
|
@client.http.request(
|
|
219
219
|
Route.new("/stage-instances/#{@channel_id}", "//stage-instances/:stage_instance_id",
|
|
@@ -223,8 +223,8 @@ module Discorb
|
|
|
223
223
|
end
|
|
224
224
|
end
|
|
225
225
|
|
|
226
|
-
alias destroy
|
|
227
|
-
alias end
|
|
226
|
+
alias destroy delete
|
|
227
|
+
alias end delete
|
|
228
228
|
|
|
229
229
|
private
|
|
230
230
|
|
data/lib/discorb/webhook.rb
CHANGED
|
@@ -135,14 +135,14 @@ module Discorb
|
|
|
135
135
|
#
|
|
136
136
|
# @return [Async::Task<void>] The task.
|
|
137
137
|
#
|
|
138
|
-
def delete
|
|
138
|
+
def delete
|
|
139
139
|
Async do
|
|
140
140
|
@http.request(Route.new(url, "//webhooks/:webhook_id/:token", :delete)).wait
|
|
141
141
|
self
|
|
142
142
|
end
|
|
143
143
|
end
|
|
144
144
|
|
|
145
|
-
alias destroy
|
|
145
|
+
alias destroy delete
|
|
146
146
|
|
|
147
147
|
#
|
|
148
148
|
# Edits the webhook's message.
|
|
@@ -191,7 +191,7 @@ module Discorb
|
|
|
191
191
|
#
|
|
192
192
|
# @return [Async::Task<void>] The task.
|
|
193
193
|
#
|
|
194
|
-
def delete_message
|
|
194
|
+
def delete_message(message)
|
|
195
195
|
Async do
|
|
196
196
|
@http.request(
|
|
197
197
|
Route.new(
|
|
@@ -385,9 +385,9 @@ module Discorb
|
|
|
385
385
|
#
|
|
386
386
|
# @return [Async::Task<void>] The task.
|
|
387
387
|
#
|
|
388
|
-
def delete
|
|
388
|
+
def delete
|
|
389
389
|
Async do
|
|
390
|
-
@webhook.delete_message
|
|
390
|
+
@webhook.delete_message(self).wait
|
|
391
391
|
end
|
|
392
392
|
end
|
|
393
393
|
|
data/sig/discorb/activity.rbs
CHANGED
|
@@ -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.
|
|
@@ -85,8 +86,10 @@ module Discorb
|
|
|
85
86
|
# The team's owner.
|
|
86
87
|
#
|
|
87
88
|
# @return [Discorb::Application::Team::Member] The team's owner.
|
|
89
|
+
%a{pure}
|
|
88
90
|
def owner: -> Discorb::Application::Team::Member
|
|
89
91
|
|
|
92
|
+
%a{pure}
|
|
90
93
|
def inspect: -> String
|
|
91
94
|
|
|
92
95
|
# @return [Discorb::Snowflake] The team's ID.
|
|
@@ -111,6 +114,7 @@ module Discorb
|
|
|
111
114
|
|
|
112
115
|
def initialize: (untyped client, untyped team, untyped data) -> void
|
|
113
116
|
|
|
117
|
+
%a{pure}
|
|
114
118
|
def inspect: -> String
|
|
115
119
|
|
|
116
120
|
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
|
@@ -34,20 +34,27 @@ module Discorb
|
|
|
34
34
|
|
|
35
35
|
# @return [Symbol] Returns the type of the preset.
|
|
36
36
|
# @note This is only available if the trigger type is `:keyword_preset`.
|
|
37
|
+
%a{pure}
|
|
37
38
|
def preset_type: -> preset_type
|
|
38
39
|
|
|
39
40
|
# @return [Symbol] Returns the type of the trigger.
|
|
41
|
+
%a{pure}
|
|
40
42
|
def trigger_type: -> trigger_type
|
|
41
43
|
|
|
42
44
|
# @return [Symbol] Returns the type of the event.
|
|
45
|
+
%a{pure}
|
|
43
46
|
def event_type: -> :message_send
|
|
44
47
|
|
|
48
|
+
%a{pure}
|
|
45
49
|
def creator: -> Discorb::Member
|
|
46
50
|
|
|
51
|
+
%a{pure}
|
|
47
52
|
def guild: -> Discorb::Guild
|
|
48
53
|
|
|
54
|
+
%a{pure}
|
|
49
55
|
def exempt_roles: -> Array[Discorb::Role]
|
|
50
56
|
|
|
57
|
+
%a{pure}
|
|
51
58
|
def exempt_channels: -> Array[Discorb::Channel]
|
|
52
59
|
|
|
53
60
|
#
|
|
@@ -76,7 +83,7 @@ module Discorb
|
|
|
76
83
|
# @return [Async::Task<void>] The task.
|
|
77
84
|
def edit: (
|
|
78
85
|
?name: String,
|
|
79
|
-
?event_type: :
|
|
86
|
+
?event_type: :message_send,
|
|
80
87
|
?actions: Array[Discorb::AutoModRule::Action],
|
|
81
88
|
?enabled: bool,
|
|
82
89
|
?exempt_roles: Array[Discorb::Role],
|
|
@@ -92,20 +99,29 @@ module Discorb
|
|
|
92
99
|
# @param [String] reason The reason for deleting the rule.
|
|
93
100
|
#
|
|
94
101
|
# @return [Async::Task<void>] The task.
|
|
95
|
-
def delete
|
|
102
|
+
def delete: (?reason: nil) -> Async::Task[void]
|
|
96
103
|
|
|
97
104
|
class Action < Discorb::DiscordModel
|
|
105
|
+
type action_type = :ban | :kick | :mute | :warn
|
|
106
|
+
|
|
98
107
|
# @return [Hash{Integer => Symbol}] The mapping of action types.
|
|
99
108
|
# @private
|
|
100
|
-
ACTION_TYPES: Hash[Integer,
|
|
109
|
+
ACTION_TYPES: Hash[Integer, action_type]
|
|
101
110
|
|
|
102
111
|
# @return [Symbol] Returns the type of the action.
|
|
103
|
-
attr_reader type:
|
|
112
|
+
attr_reader type: action_type
|
|
104
113
|
|
|
105
114
|
# @return [Integer] The duration of the timeout.
|
|
106
115
|
# @note This is only available if the action type is `:timeout`.
|
|
107
116
|
attr_reader duration_seconds: Integer?
|
|
108
117
|
|
|
118
|
+
#
|
|
119
|
+
# Convert the action to hash.
|
|
120
|
+
#
|
|
121
|
+
# @return [Hash] The action hash.
|
|
122
|
+
%a{pure}
|
|
123
|
+
def to_hash: -> Discorb::json
|
|
124
|
+
|
|
109
125
|
#
|
|
110
126
|
# Initialize a new action.
|
|
111
127
|
#
|
|
@@ -115,13 +131,14 @@ module Discorb
|
|
|
115
131
|
# @param [Discorb::Channel] channel The channel that the alert message is sent to.
|
|
116
132
|
# This is only available if the action type is `:send_alert_message`.
|
|
117
133
|
def initialize: (
|
|
118
|
-
|
|
134
|
+
action_type `type`,
|
|
119
135
|
?duration_seconds: Integer?,
|
|
120
136
|
?channel: Discorb::Channel?
|
|
121
137
|
) -> void
|
|
122
138
|
|
|
123
139
|
# @return [Discorb::Channel] The channel that the alert message is sent to.
|
|
124
140
|
# @note This is only available if the action type is `:send_alert_message`.
|
|
141
|
+
%a{pure}
|
|
125
142
|
def channel: -> Discorb::Channel?
|
|
126
143
|
end
|
|
127
144
|
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.
|