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
data/lib/discorb/message.rb
CHANGED
|
@@ -7,7 +7,7 @@ module Discorb
|
|
|
7
7
|
class Message < DiscordModel
|
|
8
8
|
# @return [Discorb::Snowflake] The ID of the message.
|
|
9
9
|
attr_reader :id
|
|
10
|
-
# @return [Discorb::User, Discorb::Member] The user that sent the message.
|
|
10
|
+
# @return [Discorb::User, Discorb::Member, Webhook::Message::Author] The user that sent the message.
|
|
11
11
|
attr_reader :author
|
|
12
12
|
# @return [String] The content of the message.
|
|
13
13
|
attr_reader :content
|
|
@@ -217,8 +217,8 @@ module Discorb
|
|
|
217
217
|
end
|
|
218
218
|
if role
|
|
219
219
|
ret.gsub!(/<@&(\d+)>/) do |_match|
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
r = guild&.roles&.[]($1)
|
|
221
|
+
r ? "@#{r.name}" : "@Unknown Role"
|
|
222
222
|
end
|
|
223
223
|
end
|
|
224
224
|
if emoji
|
|
@@ -293,15 +293,17 @@ module Discorb
|
|
|
293
293
|
#
|
|
294
294
|
# @param [Boolean] fail_if_not_exists Whether to raise an error if the message does not exist.
|
|
295
295
|
#
|
|
296
|
-
# @return [
|
|
296
|
+
# @return [Discorb::Message::Reference] The reference object.
|
|
297
297
|
#
|
|
298
298
|
def to_reference(fail_if_not_exists: true)
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
299
|
+
Reference.from_hash(
|
|
300
|
+
{
|
|
301
|
+
message_id: @id,
|
|
302
|
+
channel_id: @channel_id,
|
|
303
|
+
guild_id: @guild_id,
|
|
304
|
+
fail_if_not_exists: fail_if_not_exists,
|
|
305
|
+
}
|
|
306
|
+
)
|
|
305
307
|
end
|
|
306
308
|
|
|
307
309
|
def embed
|
|
@@ -400,7 +402,7 @@ module Discorb
|
|
|
400
402
|
# Fetch reacted users of reaction.
|
|
401
403
|
# @async
|
|
402
404
|
#
|
|
403
|
-
# @param [Discorb::Emoji] emoji The emoji to fetch.
|
|
405
|
+
# @param [Discorb::Emoji, Discorb::PartialEmoji] emoji The emoji to fetch.
|
|
404
406
|
# @param [Integer, nil] limit The maximum number of users to fetch. `nil` for no limit.
|
|
405
407
|
# @param [Discorb::Snowflake, nil] after The ID of the user to start fetching from.
|
|
406
408
|
#
|
data/lib/discorb/message_meta.rb
CHANGED
|
@@ -76,8 +76,6 @@ module Discorb
|
|
|
76
76
|
}
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
alias to_reference to_hash
|
|
80
|
-
|
|
81
79
|
#
|
|
82
80
|
# Initialize a new reference from a hash.
|
|
83
81
|
#
|
|
@@ -141,7 +139,8 @@ module Discorb
|
|
|
141
139
|
def initialize(client, data)
|
|
142
140
|
@id = Snowflake.new(data[:id])
|
|
143
141
|
@name = data[:name]
|
|
144
|
-
@type = Discorb::Interaction.descendants.find { |c| c.interaction_type == data[:type] }
|
|
142
|
+
@type = (Discorb::Interaction.descendants.find { |c| c.interaction_type == data[:type] } or
|
|
143
|
+
raise "Unknown interaction type: #{data[:type]}")
|
|
145
144
|
@user = client.users[data[:user][:id]] || User.new(client, data[:user])
|
|
146
145
|
end
|
|
147
146
|
|
data/lib/discorb/modules.rb
CHANGED
|
@@ -44,7 +44,7 @@ module Discorb
|
|
|
44
44
|
payload[:embeds] = tmp_embed.map(&:to_hash) if tmp_embed
|
|
45
45
|
payload[:allowed_mentions] =
|
|
46
46
|
allowed_mentions ? allowed_mentions.to_hash(@client.allowed_mentions) : @client.allowed_mentions.to_hash
|
|
47
|
-
payload[:message_reference] = reference.to_reference if reference
|
|
47
|
+
payload[:message_reference] = reference.to_reference.to_hash if reference
|
|
48
48
|
payload[:components] = Component.to_payload(components) if components
|
|
49
49
|
attachments ||= attachment ? [attachment] : []
|
|
50
50
|
|
|
@@ -265,10 +265,11 @@ module Discorb
|
|
|
265
265
|
sleep(5)
|
|
266
266
|
end
|
|
267
267
|
end
|
|
268
|
-
yield
|
|
268
|
+
ret = yield
|
|
269
269
|
ensure
|
|
270
270
|
post_task.stop
|
|
271
271
|
end
|
|
272
|
+
ret
|
|
272
273
|
else
|
|
273
274
|
Async do |_task|
|
|
274
275
|
@client.http.request(Route.new("/channels/#{@id}/typing", "//channels/:channel_id/typing", :post), {})
|
data/lib/discorb/presence.rb
CHANGED
|
@@ -113,8 +113,8 @@ module Discorb
|
|
|
113
113
|
@details = data[:details]
|
|
114
114
|
@state = data[:state]
|
|
115
115
|
@emoji = if data[:emoji]
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
data[:emoji][:id].nil? ? UnicodeEmoji.new(data[:emoji][:name]) : PartialEmoji.new(data[:emoji])
|
|
117
|
+
end
|
|
118
118
|
@party = data[:party] && Party.new(data[:party])
|
|
119
119
|
@assets = data[:assets] && Asset.new(data[:assets])
|
|
120
120
|
@instance = data[:instance]
|
|
@@ -141,6 +141,8 @@ module Discorb
|
|
|
141
141
|
"#{@emoji} #{@state}"
|
|
142
142
|
when :competing
|
|
143
143
|
"Competing in #{@name}"
|
|
144
|
+
else
|
|
145
|
+
raise "Unknown activity type: #{@type}"
|
|
144
146
|
end
|
|
145
147
|
end
|
|
146
148
|
|
data/lib/discorb/reaction.rb
CHANGED
|
@@ -7,7 +7,7 @@ module Discorb
|
|
|
7
7
|
class Reaction < DiscordModel
|
|
8
8
|
# @return [Integer] The number of users that have reacted with this emoji.
|
|
9
9
|
attr_reader :count
|
|
10
|
-
# @return [Discorb::Emoji] The emoji that was reacted with.
|
|
10
|
+
# @return [Discorb::Emoji, Discorb::PartialEmoji] The emoji that was reacted with.
|
|
11
11
|
attr_reader :emoji
|
|
12
12
|
# @return [Discorb::Message] The message that this reaction is on.
|
|
13
13
|
attr_reader :message
|
|
@@ -33,7 +33,7 @@ module Discorb
|
|
|
33
33
|
#
|
|
34
34
|
# @param (see Message#fetch_reacted_users)
|
|
35
35
|
#
|
|
36
|
-
# @return [Array<Discorb::User
|
|
36
|
+
# @return [Async::Task<Array<Discorb::User>>] The users that reacted with this emoji.
|
|
37
37
|
#
|
|
38
38
|
def fetch_users(...)
|
|
39
39
|
message.fetch_reacted_users(@emoji, ...)
|
data/lib/discorb/role.rb
CHANGED
|
@@ -69,7 +69,7 @@ module Discorb
|
|
|
69
69
|
# @return [Integer] -1 if the other role is higher, 0 if they are equal, 1 if the other role is lower.
|
|
70
70
|
#
|
|
71
71
|
def <=>(other)
|
|
72
|
-
return
|
|
72
|
+
return nil unless other.is_a?(Role)
|
|
73
73
|
|
|
74
74
|
@position <=> other.position
|
|
75
75
|
end
|
data/lib/discorb/sticker.rb
CHANGED
|
@@ -17,7 +17,7 @@ module Discorb
|
|
|
17
17
|
attr_reader :format
|
|
18
18
|
# @return [String] The URL of the sticker.
|
|
19
19
|
attr_reader :description
|
|
20
|
-
# @return [Discorb::
|
|
20
|
+
# @return [Discorb::Snowflake] The ID of the sticker pack.
|
|
21
21
|
attr_reader :pack_id
|
|
22
22
|
# @return [Integer] The sort value of the sticker.
|
|
23
23
|
attr_reader :sort_value
|
|
@@ -87,7 +87,7 @@ module Discorb
|
|
|
87
87
|
payload[:tags] = tag.name unless tag == Discorb::Unset
|
|
88
88
|
@client.http.request(
|
|
89
89
|
Route.new("/guilds/#{@guild_id}/stickers/#{@id}", "//guilds/:guild_id/stickers/:sticker_id",
|
|
90
|
-
:patch), payload, audit_log_reason: reason
|
|
90
|
+
:patch), payload, audit_log_reason: reason,
|
|
91
91
|
).wait
|
|
92
92
|
end
|
|
93
93
|
end
|
|
@@ -104,7 +104,7 @@ module Discorb
|
|
|
104
104
|
Async do
|
|
105
105
|
@client.http.request(
|
|
106
106
|
Route.new("/guilds/#{@guild_id}/stickers/#{@id}", "//guilds/:guild_id/stickers/:sticker_id",
|
|
107
|
-
:delete), {}, audit_log_reason: reason
|
|
107
|
+
:delete), {}, audit_log_reason: reason,
|
|
108
108
|
).wait
|
|
109
109
|
end
|
|
110
110
|
end
|
data/lib/discorb/user.rb
CHANGED
|
@@ -16,7 +16,7 @@ module Discorb
|
|
|
16
16
|
attr_reader :flag
|
|
17
17
|
# @return [String] The user's discriminator.
|
|
18
18
|
attr_reader :discriminator
|
|
19
|
-
# @return [Discorb::Asset] The user's avatar.
|
|
19
|
+
# @return [Discorb::Asset, Discorb::DefaultAvatar] The user's avatar.
|
|
20
20
|
attr_reader :avatar
|
|
21
21
|
# @return [Boolean] Whether the user is a bot.
|
|
22
22
|
attr_reader :bot
|
|
@@ -147,7 +147,7 @@ module Discorb
|
|
|
147
147
|
@flag = User::Flag.new(data[:public_flags] | (data[:flags] || 0))
|
|
148
148
|
@discriminator = data[:discriminator]
|
|
149
149
|
@avatar = data[:avatar] ? Asset.new(self, data[:avatar]) : DefaultAvatar.new(data[:discriminator])
|
|
150
|
-
@bot = data[:bot]
|
|
150
|
+
@bot = data[:bot] || false
|
|
151
151
|
@raw_data = data
|
|
152
152
|
@client.users[@id] = self unless data[:no_cache]
|
|
153
153
|
@created_at = @id.timestamp
|
data/lib/discorb/voice_state.rb
CHANGED
|
@@ -95,10 +95,10 @@ module Discorb
|
|
|
95
95
|
@user_id = data[:user_id]
|
|
96
96
|
unless guild.nil?
|
|
97
97
|
@member = if data.key?(:member)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
guild.members[data[:user_id]] || Member.new(@client, @guild_id, data[:member][:user], data[:member])
|
|
99
|
+
else
|
|
100
|
+
guild.members[data[:user_id]]
|
|
101
|
+
end
|
|
102
102
|
end
|
|
103
103
|
@session_id = data[:session_id]
|
|
104
104
|
@deaf = data[:deaf]
|
|
@@ -217,7 +217,7 @@ module Discorb
|
|
|
217
217
|
Async do
|
|
218
218
|
@client.http.request(
|
|
219
219
|
Route.new("/stage-instances/#{@channel_id}", "//stage-instances/:stage_instance_id",
|
|
220
|
-
:delete), {}, audit_log_reason: reason
|
|
220
|
+
:delete), {}, audit_log_reason: reason,
|
|
221
221
|
).wait
|
|
222
222
|
self
|
|
223
223
|
end
|
data/lib/discorb/webhook.rb
CHANGED
|
@@ -91,8 +91,15 @@ module Discorb
|
|
|
91
91
|
payload[:username] = username if username
|
|
92
92
|
payload[:avatar_url] = avatar_url if avatar_url != Discorb::Unset
|
|
93
93
|
attachments = [attachment] if attachment
|
|
94
|
-
_resp, data = @http.multipart_request(
|
|
95
|
-
|
|
94
|
+
_resp, data = @http.multipart_request(
|
|
95
|
+
Route.new(
|
|
96
|
+
"#{url}?wait=#{wait}",
|
|
97
|
+
"//webhooks/:webhook_id/:token",
|
|
98
|
+
:post
|
|
99
|
+
),
|
|
100
|
+
attachments,
|
|
101
|
+
payload
|
|
102
|
+
).wait
|
|
96
103
|
data && Webhook::Message.new(self, data)
|
|
97
104
|
end
|
|
98
105
|
end
|
|
@@ -207,11 +214,12 @@ module Discorb
|
|
|
207
214
|
# Initializes the webhook from URL.
|
|
208
215
|
#
|
|
209
216
|
# @param [String] url The URL of the webhook.
|
|
217
|
+
# @param [Discorb::Client] client The client to associate with the webhook.
|
|
210
218
|
#
|
|
211
|
-
def initialize(url)
|
|
219
|
+
def initialize(url, client: nil)
|
|
212
220
|
@url = url
|
|
213
221
|
@token = ""
|
|
214
|
-
@http = Discorb::HTTP.new(
|
|
222
|
+
@http = Discorb::HTTP.new(client || Discorb::Client.new)
|
|
215
223
|
end
|
|
216
224
|
end
|
|
217
225
|
|
|
@@ -459,12 +467,13 @@ module Discorb
|
|
|
459
467
|
# Creates URLWebhook.
|
|
460
468
|
#
|
|
461
469
|
# @param [String] url The URL of the webhook.
|
|
470
|
+
# @param [Discorb::Client] client The client to associate with the webhook.
|
|
462
471
|
#
|
|
463
472
|
# @return [Discorb::Webhook::URLWebhook] The URLWebhook.
|
|
464
473
|
#
|
|
465
|
-
def new(url)
|
|
474
|
+
def new(url, client: nil)
|
|
466
475
|
if self == Webhook
|
|
467
|
-
URLWebhook.new(url)
|
|
476
|
+
URLWebhook.new(url, client: client)
|
|
468
477
|
else
|
|
469
478
|
super
|
|
470
479
|
end
|
data/lib/discorb.rb
CHANGED
|
@@ -46,10 +46,10 @@ end
|
|
|
46
46
|
require_order = %w[common flag dictionary error rate_limit http intents emoji_table modules] +
|
|
47
47
|
%w[channel/container message_meta allowed_mentions] +
|
|
48
48
|
%w[user member guild emoji channel embed message] +
|
|
49
|
-
%w[application audit_logs color components event event_handler] +
|
|
49
|
+
%w[application audit_logs color components event event_handler automod] +
|
|
50
50
|
%w[attachment guild_template image integration interaction invite permission] +
|
|
51
51
|
%w[presence reaction role sticker utils voice_state webhook] +
|
|
52
|
-
%w[gateway_requests gateway app_command] +
|
|
52
|
+
%w[gateway_requests gateway_events gateway app_command] +
|
|
53
53
|
%w[asset extension shard client extend]
|
|
54
54
|
require_order.each do |name|
|
|
55
55
|
require_relative "discorb/#{name}.rb"
|
data/rbs_collection.lock.yaml
CHANGED
|
@@ -1,96 +1,88 @@
|
|
|
1
|
-
---
|
|
2
|
-
sources:
|
|
3
|
-
- name: ruby/gem_rbs_collection
|
|
4
|
-
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
5
|
-
revision: main
|
|
6
|
-
repo_dir: gems
|
|
7
|
-
path: ".gem_rbs_collection"
|
|
8
|
-
gems:
|
|
9
|
-
- name:
|
|
10
|
-
version: '
|
|
11
|
-
source:
|
|
12
|
-
type:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- name: ast
|
|
18
|
-
version: '2.4'
|
|
19
|
-
source:
|
|
20
|
-
type: git
|
|
21
|
-
name: ruby/gem_rbs_collection
|
|
22
|
-
revision:
|
|
23
|
-
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
24
|
-
repo_dir: gems
|
|
25
|
-
- name:
|
|
26
|
-
version: '0'
|
|
27
|
-
source:
|
|
28
|
-
type: stdlib
|
|
29
|
-
- name:
|
|
30
|
-
version: '
|
|
31
|
-
source:
|
|
32
|
-
type:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- name: parallel
|
|
50
|
-
version: '1.20'
|
|
51
|
-
source:
|
|
52
|
-
type: git
|
|
53
|
-
name: ruby/gem_rbs_collection
|
|
54
|
-
revision:
|
|
55
|
-
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
56
|
-
repo_dir: gems
|
|
57
|
-
- name: prime
|
|
58
|
-
version: '0'
|
|
59
|
-
source:
|
|
60
|
-
type: stdlib
|
|
61
|
-
- name: rainbow
|
|
62
|
-
version: '3.0'
|
|
63
|
-
source:
|
|
64
|
-
type: git
|
|
65
|
-
name: ruby/gem_rbs_collection
|
|
66
|
-
revision:
|
|
67
|
-
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
68
|
-
repo_dir: gems
|
|
69
|
-
- name: singleton
|
|
70
|
-
version: '0'
|
|
71
|
-
source:
|
|
72
|
-
type: stdlib
|
|
73
|
-
- name:
|
|
74
|
-
version: '0'
|
|
75
|
-
source:
|
|
76
|
-
type: stdlib
|
|
77
|
-
- name:
|
|
78
|
-
version: '0'
|
|
79
|
-
source:
|
|
80
|
-
type: stdlib
|
|
81
|
-
- name: monitor
|
|
82
|
-
version: '0'
|
|
83
|
-
source:
|
|
84
|
-
type: stdlib
|
|
85
|
-
- name:
|
|
86
|
-
version: '0'
|
|
87
|
-
source:
|
|
88
|
-
type: stdlib
|
|
89
|
-
- name: mutex_m
|
|
90
|
-
version: '0'
|
|
91
|
-
source:
|
|
92
|
-
type: stdlib
|
|
93
|
-
- name: pathname
|
|
94
|
-
version: '0'
|
|
95
|
-
source:
|
|
96
|
-
type: stdlib
|
|
1
|
+
---
|
|
2
|
+
sources:
|
|
3
|
+
- name: ruby/gem_rbs_collection
|
|
4
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
5
|
+
revision: main
|
|
6
|
+
repo_dir: gems
|
|
7
|
+
path: ".gem_rbs_collection"
|
|
8
|
+
gems:
|
|
9
|
+
- name: net-http
|
|
10
|
+
version: '0'
|
|
11
|
+
source:
|
|
12
|
+
type: stdlib
|
|
13
|
+
- name: logger
|
|
14
|
+
version: '0'
|
|
15
|
+
source:
|
|
16
|
+
type: stdlib
|
|
17
|
+
- name: ast
|
|
18
|
+
version: '2.4'
|
|
19
|
+
source:
|
|
20
|
+
type: git
|
|
21
|
+
name: ruby/gem_rbs_collection
|
|
22
|
+
revision: 347858a6750d478f6cf1285b4ebd6ae945af2609
|
|
23
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
24
|
+
repo_dir: gems
|
|
25
|
+
- name: forwardable
|
|
26
|
+
version: '0'
|
|
27
|
+
source:
|
|
28
|
+
type: stdlib
|
|
29
|
+
- name: i18n
|
|
30
|
+
version: '1.10'
|
|
31
|
+
source:
|
|
32
|
+
type: git
|
|
33
|
+
name: ruby/gem_rbs_collection
|
|
34
|
+
revision: 347858a6750d478f6cf1285b4ebd6ae945af2609
|
|
35
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
36
|
+
repo_dir: gems
|
|
37
|
+
- name: listen
|
|
38
|
+
version: '3.2'
|
|
39
|
+
source:
|
|
40
|
+
type: git
|
|
41
|
+
name: ruby/gem_rbs_collection
|
|
42
|
+
revision: 347858a6750d478f6cf1285b4ebd6ae945af2609
|
|
43
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
44
|
+
repo_dir: gems
|
|
45
|
+
- name: minitest
|
|
46
|
+
version: '0'
|
|
47
|
+
source:
|
|
48
|
+
type: stdlib
|
|
49
|
+
- name: parallel
|
|
50
|
+
version: '1.20'
|
|
51
|
+
source:
|
|
52
|
+
type: git
|
|
53
|
+
name: ruby/gem_rbs_collection
|
|
54
|
+
revision: 347858a6750d478f6cf1285b4ebd6ae945af2609
|
|
55
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
56
|
+
repo_dir: gems
|
|
57
|
+
- name: prime
|
|
58
|
+
version: '0'
|
|
59
|
+
source:
|
|
60
|
+
type: stdlib
|
|
61
|
+
- name: rainbow
|
|
62
|
+
version: '3.0'
|
|
63
|
+
source:
|
|
64
|
+
type: git
|
|
65
|
+
name: ruby/gem_rbs_collection
|
|
66
|
+
revision: 347858a6750d478f6cf1285b4ebd6ae945af2609
|
|
67
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
68
|
+
repo_dir: gems
|
|
69
|
+
- name: singleton
|
|
70
|
+
version: '0'
|
|
71
|
+
source:
|
|
72
|
+
type: stdlib
|
|
73
|
+
- name: uri
|
|
74
|
+
version: '0'
|
|
75
|
+
source:
|
|
76
|
+
type: stdlib
|
|
77
|
+
- name: timeout
|
|
78
|
+
version: '0'
|
|
79
|
+
source:
|
|
80
|
+
type: stdlib
|
|
81
|
+
- name: monitor
|
|
82
|
+
version: '0'
|
|
83
|
+
source:
|
|
84
|
+
type: stdlib
|
|
85
|
+
- name: mutex_m
|
|
86
|
+
version: '0'
|
|
87
|
+
source:
|
|
88
|
+
type: stdlib
|
data/rbs_collection.yaml
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
# Download sources
|
|
2
|
-
sources:
|
|
3
|
-
- name: ruby/gem_rbs_collection
|
|
4
|
-
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
5
|
-
revision: main
|
|
6
|
-
repo_dir: gems
|
|
7
|
-
|
|
8
|
-
# A directory to install the downloaded RBSs
|
|
9
|
-
path: .gem_rbs_collection
|
|
10
|
-
|
|
11
|
-
gems:
|
|
12
|
-
# Skip loading rbs gem's RBS.
|
|
13
|
-
# It's unnecessary if you don't use rbs as a library.
|
|
14
|
-
- name: rbs
|
|
15
|
-
ignore: true
|
|
16
|
-
- name: discorb
|
|
17
|
-
ignore: true
|
|
1
|
+
# Download sources
|
|
2
|
+
sources:
|
|
3
|
+
- name: ruby/gem_rbs_collection
|
|
4
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
5
|
+
revision: main
|
|
6
|
+
repo_dir: gems
|
|
7
|
+
|
|
8
|
+
# A directory to install the downloaded RBSs
|
|
9
|
+
path: .gem_rbs_collection
|
|
10
|
+
|
|
11
|
+
gems:
|
|
12
|
+
# Skip loading rbs gem's RBS.
|
|
13
|
+
# It's unnecessary if you don't use rbs as a library.
|
|
14
|
+
- name: rbs
|
|
15
|
+
ignore: true
|
|
16
|
+
- name: discorb
|
|
17
|
+
ignore: true
|
|
18
|
+
- name: net-http
|
|
19
|
+
- name: logger
|
|
20
|
+
- name: activesupport
|
|
21
|
+
ignore: true
|
data/sig/async.rbs
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
module Async
|
|
2
|
-
class Task[T]
|
|
3
|
-
def wait:
|
|
4
|
-
end
|
|
5
|
-
|
|
1
|
+
module Async
|
|
2
|
+
class Task[T]
|
|
3
|
+
def wait: -> T
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
module WebSocket
|
|
7
|
+
class Connection
|
|
8
|
+
def initialize: (untyped, ?untyped, response: untyped, **untyped) -> void
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Discorb
|
|
2
|
+
#
|
|
3
|
+
# Represents an activity for Gateway Command.
|
|
4
|
+
class Activity
|
|
5
|
+
TYPES: untyped
|
|
6
|
+
|
|
7
|
+
#
|
|
8
|
+
# Initializes a new Activity.
|
|
9
|
+
#
|
|
10
|
+
# @param [String] name The name of the activity.
|
|
11
|
+
# @param [:playing, :streaming, :listening, :watching, :competing] type The type of activity.
|
|
12
|
+
# @param [String] url The URL of the activity.
|
|
13
|
+
def initialize: (String name, ?Symbol `type`, ?String? url) -> void
|
|
14
|
+
|
|
15
|
+
#
|
|
16
|
+
# Converts the activity to a hash.
|
|
17
|
+
#
|
|
18
|
+
# @return [Hash] A hash representation of the activity.
|
|
19
|
+
def to_hash: -> Discorb::json
|
|
20
|
+
|
|
21
|
+
def inspect: -> String
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module Discorb
|
|
2
|
+
#
|
|
3
|
+
# Represents a allowed mentions in a message.
|
|
4
|
+
class AllowedMentions
|
|
5
|
+
#
|
|
6
|
+
# Initializes a new instance of the AllowedMentions class.
|
|
7
|
+
#
|
|
8
|
+
# @param [Boolean] everyone Whether to allow @everyone or @here.
|
|
9
|
+
# @param [Boolean, Array<Discorb::Role>] roles The roles to allow, or false to disable.
|
|
10
|
+
# @param [Boolean, Array<Discorb::User>] users The users to allow, or false to disable.
|
|
11
|
+
# @param [Boolean] replied_user Whether to ping the user that sent the message to reply.
|
|
12
|
+
def initialize: (
|
|
13
|
+
?everyone: bool?,
|
|
14
|
+
?roles: (bool | ::Array[Discorb::Role])?,
|
|
15
|
+
?users: (bool | ::Array[Discorb::User])?,
|
|
16
|
+
?replied_user: bool?
|
|
17
|
+
) -> void
|
|
18
|
+
|
|
19
|
+
def inspect: -> String
|
|
20
|
+
|
|
21
|
+
#
|
|
22
|
+
# Converts the object to a hash.
|
|
23
|
+
# @private
|
|
24
|
+
#
|
|
25
|
+
# @param [Discorb::AllowedMentions, nil] other The object to merge.
|
|
26
|
+
#
|
|
27
|
+
# @return [Hash] The hash.
|
|
28
|
+
def to_hash: (?Discorb::AllowedMentions? other) -> ::Hash[untyped, untyped]
|
|
29
|
+
|
|
30
|
+
def nil_merge: (*untyped args) -> untyped
|
|
31
|
+
|
|
32
|
+
# @return [Boolean] Whether to allow @everyone or @here.
|
|
33
|
+
attr_accessor everyone: bool?
|
|
34
|
+
|
|
35
|
+
# @return [Boolean, Array<Discorb::Role>] The roles to allow, or false to disable.
|
|
36
|
+
attr_accessor roles: (bool | ::Array[Discorb::Role])?
|
|
37
|
+
|
|
38
|
+
# @return [Boolean, Array<Discorb::User>] The users to allow, or false to disable.
|
|
39
|
+
attr_accessor users: (bool | ::Array[Discorb::User])?
|
|
40
|
+
|
|
41
|
+
# @return [Boolean] Whether to ping the user that sent the message to reply.
|
|
42
|
+
attr_accessor replied_user: bool?
|
|
43
|
+
end
|
|
44
|
+
end
|