discorb 0.13.3 → 0.13.4
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/CODE_OF_CONDUCT.md +128 -0
- data/Changelog.md +8 -0
- data/lib/discorb/app_command.rb +24 -2
- data/lib/discorb/channel.rb +42 -49
- data/lib/discorb/client.rb +7 -7
- data/lib/discorb/common.rb +30 -1
- data/lib/discorb/dictionary.rb +10 -2
- data/lib/discorb/emoji.rb +2 -2
- data/lib/discorb/event.rb +4 -4
- data/lib/discorb/gateway.rb +26 -5
- data/lib/discorb/guild.rb +47 -67
- data/lib/discorb/guild_template.rb +3 -3
- data/lib/discorb/http.rb +25 -158
- data/lib/discorb/integration.rb +1 -1
- data/lib/discorb/interaction/autocomplete.rb +1 -1
- data/lib/discorb/interaction/response.rb +8 -8
- data/lib/discorb/invite.rb +1 -1
- data/lib/discorb/log.rb +3 -2
- data/lib/discorb/member.rb +3 -3
- data/lib/discorb/message.rb +5 -5
- data/lib/discorb/modules.rb +10 -10
- data/lib/discorb/presence.rb +2 -2
- data/lib/discorb/rate_limit.rb +14 -18
- data/lib/discorb/role.rb +3 -3
- data/lib/discorb/sticker.rb +2 -2
- data/lib/discorb/user.rb +3 -3
- data/lib/discorb/voice_state.rb +4 -2
- data/lib/discorb/webhook.rb +8 -5
- metadata +3 -2
data/lib/discorb/user.rb
CHANGED
@@ -84,7 +84,7 @@ module Discorb
|
|
84
84
|
Async do
|
85
85
|
next @dm_channel_id if @dm_channel_id
|
86
86
|
|
87
|
-
_resp, dm_channel = @client.http.
|
87
|
+
_resp, dm_channel = @client.http.request(Route.new("/users/@me/channels", "//users/@me/channels", :post), { recipient_id: @id }).wait
|
88
88
|
@dm_channel_id = dm_channel[:id]
|
89
89
|
@dm_channel_id
|
90
90
|
end
|
@@ -137,7 +137,7 @@ module Discorb
|
|
137
137
|
@avatar = data[:avatar] ? Asset.new(self, data[:avatar]) : DefaultAvatar.new(data[:discriminator])
|
138
138
|
@bot = data[:bot]
|
139
139
|
@raw_data = data
|
140
|
-
@client.users[@id] = self if !data[:no_cache]
|
140
|
+
@client.users[@id] = self if !data[:no_cache]
|
141
141
|
@created_at = @id.timestamp
|
142
142
|
@data.update(data)
|
143
143
|
end
|
@@ -168,7 +168,7 @@ module Discorb
|
|
168
168
|
else
|
169
169
|
payload[:avatar] = avatar.to_s
|
170
170
|
end
|
171
|
-
@client.http.
|
171
|
+
@client.http.request(Route.new("/users/@me", "//users/@me", :patch), payload).wait
|
172
172
|
self
|
173
173
|
end
|
174
174
|
end
|
data/lib/discorb/voice_state.rb
CHANGED
@@ -180,7 +180,9 @@ module Discorb
|
|
180
180
|
payload = {}
|
181
181
|
payload[:topic] = topic if topic != Discorb::Unset
|
182
182
|
payload[:privacy_level] = self.class.privacy_level.key(privacy_level) if privacy_level != Discorb::Unset
|
183
|
-
@client.http.
|
183
|
+
@client.http.request(
|
184
|
+
Route.new("/stage-instances/#{@channel_id}", "//stage-instances/:channel_id", :patch), payload, audit_log_reason: reason,
|
185
|
+
).wait
|
184
186
|
self
|
185
187
|
end
|
186
188
|
end
|
@@ -196,7 +198,7 @@ module Discorb
|
|
196
198
|
#
|
197
199
|
def delete!(reason: nil)
|
198
200
|
Async do
|
199
|
-
@client.http.
|
201
|
+
@client.http.request(Route.new("/stage-instances/#{@channel_id}", "//stage-instances/:stage_instance_id", :delete), audit_log_reason: reason).wait
|
200
202
|
self
|
201
203
|
end
|
202
204
|
end
|
data/lib/discorb/webhook.rb
CHANGED
@@ -75,7 +75,7 @@ module Discorb
|
|
75
75
|
payload[:username] = username if username
|
76
76
|
payload[:avatar_url] = avatar_url if avatar_url != Discorb::Unset
|
77
77
|
files = [file]
|
78
|
-
_resp, data = @http.
|
78
|
+
_resp, data = @http.multipart_request(Route.new("#{url}?wait=#{wait}", "//webhooks/:webhook_id/:token", :post), files, payload, headers: headers).wait
|
79
79
|
data && Webhook::Message.new(self, data)
|
80
80
|
end
|
81
81
|
end
|
@@ -99,7 +99,7 @@ module Discorb
|
|
99
99
|
payload[:name] = name if name != Discorb::Unset
|
100
100
|
payload[:avatar] = avatar if avatar != Discorb::Unset
|
101
101
|
payload[:channel_id] = Utils.try(channel, :id) if channel != Discorb::Unset
|
102
|
-
@http.
|
102
|
+
@http.request(Route.new(url, "//webhooks/:webhook_id/:token", :patch), payload).wait
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
@@ -113,7 +113,7 @@ module Discorb
|
|
113
113
|
#
|
114
114
|
def delete!
|
115
115
|
Async do
|
116
|
-
@http.
|
116
|
+
@http.request(Route.new(url, "//webhooks/:webhook_id/:token", :delete)).wait
|
117
117
|
self
|
118
118
|
end
|
119
119
|
end
|
@@ -151,7 +151,7 @@ module Discorb
|
|
151
151
|
payload[:attachments] = attachments.map(&:to_hash) if attachments != Discorb::Unset
|
152
152
|
payload[:allowed_mentions] = allowed_mentions if allowed_mentions != Discorb::Unset
|
153
153
|
files = [file] if file != Discorb::Unset
|
154
|
-
_resp, data = @http.
|
154
|
+
_resp, data = @http.multipart_request(Route.new("#{url}/messages/#{Utils.try(message, :id)}", "//webhooks/:webhook_id/:token/messages/:message_id", :patch), payload, headers: headers).wait
|
155
155
|
message.send(:_set_data, data)
|
156
156
|
message
|
157
157
|
end
|
@@ -166,7 +166,10 @@ module Discorb
|
|
166
166
|
#
|
167
167
|
def delete_message!(message)
|
168
168
|
Async do
|
169
|
-
@http.
|
169
|
+
@http.request(Route.new(
|
170
|
+
"#{url}/messages/#{Utils.try(message, :id)}",
|
171
|
+
"//webhooks/:webhook_id/:token/messages/:message_id", :delete
|
172
|
+
)).wait
|
170
173
|
message
|
171
174
|
end
|
172
175
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: discorb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sevenc-nanashi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- ".github/workflows/package_register.yml"
|
94
94
|
- ".gitignore"
|
95
95
|
- ".yardopts"
|
96
|
+
- CODE_OF_CONDUCT.md
|
96
97
|
- CONTRIBUTING.md
|
97
98
|
- Changelog.md
|
98
99
|
- Gemfile
|