discorb 0.5.0 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26ef2cd9945ad11a9816b4ece328391c265b8f59f8b9a67e66326e21414f083c
4
- data.tar.gz: 06662ff1518386e95e615afffc6b8338cb9e337bb0dc36c66f6d1d79fd7a01e8
3
+ metadata.gz: 62a9092a32b87c1edbb193c7b3de777b499257a9b08f92f88a741506ecef58fe
4
+ data.tar.gz: 3df9d14c6c7ec041d9887b3479af2417295e17b148c1aea780230e84b5c0d799
5
5
  SHA512:
6
- metadata.gz: 83ddc5818285d4ed50e08998446a5fa9763cffe9c0a1992a70085af38a323e304851ca4dd77f43a8108e4ece850f097eaca9dc119b83c9bdb9a66e5c32b40f5a
7
- data.tar.gz: 8a409f031d896344586bb2001019b9431299683a99df36f090f3a0da748d08bd6b4f2191c0a32823106d5b3b0cd6d22624106367d8e4adc400acf430ddb60370
6
+ metadata.gz: f26088e7ce6f9a4bd5877263cc716722ca3523047df3623e49a082940251d3a97cea81c289239a3c9f0b456f9a21ee637f1adcd8e804084550b6af10c2aea02b
7
+ data.tar.gz: bda9f44c79c089e7cf55eeef4e774c20e3891baf09e0eb73fd2faa6e9337e5abca02b66c0e5e2c2db386d136144441f34afdf306bb427b3fcf40fa8f85f875ae
data/Changelog.md CHANGED
@@ -105,4 +105,26 @@
105
105
  - Change: Use zlib stream instead
106
106
  - Add: Add tutorials
107
107
  - Add: Add ratelimit handler
108
- - Change: Make `--git` option in `discorb init` false
108
+ - Change: Make `--git` option in `discorb init` false
109
+
110
+ ## 0.5.1
111
+
112
+ - Add: Can use block for defining group commands
113
+ - Fix: Fix bug in subcommands
114
+ - Fix: Fix bug in receiving commands
115
+
116
+ ## 0.5.2
117
+
118
+ - Fix: Fix bug of registering commands
119
+ - Add: Add way to register commands in Extension
120
+
121
+ ## 0.5.3
122
+
123
+ - Add: Add way to handle raw events with `event_xxx`
124
+ - Add: Add `Client#session_id`
125
+ - Add: Add `Connectable`
126
+ - Fix: Fix error by sending DM
127
+
128
+ ## 0.5.4
129
+
130
+ - Fix: Fix issue of receiving component events
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- discorb (0.5.0)
4
+ discorb (0.5.4)
5
5
  async (~> 1.30.1)
6
6
  async-http (~> 0.56.5)
7
7
  async-websocket (~> 0.19.0)
data/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
  [![Document](https://img.shields.io/badge/Document-discord--lib.github.io-blue.svg)](https://discorb-lib.github.io/)
3
3
  [![Gem](https://img.shields.io/gem/dt/discorb?logo=rubygems&logoColor=fff)](https://rubygems.org/gems/discorb)
4
4
  [![Gem](https://img.shields.io/gem/v/discorb?logo=rubygems&logoColor=fff)](https://rubygems.org/gems/discorb)
5
- [![Discord](https://img.shields.io/discord/863581274916913193?logo=discord&logoColor=fff&color=5865f2&label=Discord)](https://discord.gg/hCP6zq8Vpj)
5
+ [![Discord](https://img.shields.io/discord/863581274916913193?logo=discord&logoColor=fff&color=5865f2&label=Discord)](https://discord.gg/hCP6zq8Vpj)
6
+ [![GitHub](https://img.shields.io/github/stars/discorb-lib/discorb?color=24292e&label=Stars&logo=GitHub&logoColor=fff)](https://github.com/discorb-lib/discorb)
6
7
 
7
8
  discorb is a Discord API wrapper for Ruby.
8
9
 
data/Rakefile CHANGED
@@ -163,13 +163,9 @@ namespace :document do
163
163
  FileUtils.cp_r("./doc/.", "./tmp-doc")
164
164
  FileUtils.rm_rf("doc")
165
165
  end
166
- version = "."
167
- Rake::Task["document:yard"].execute
168
- Rake::Task["document:replace:html"].execute
169
- Rake::Task["document:replace:css"].execute
170
- Rake::Task["document:replace:eol"].execute
171
166
  sh "git switch main -f"
172
167
  FileUtils.cp_r("./tmp-doc/.", "./doc")
168
+ FileUtils.cp_r("./doc/#{tags.last.delete_prefix("v")}/.", "./doc")
173
169
  sputs "Successfully built all versions"
174
170
  rescue => e
175
171
  sh "git switch main -f"
@@ -53,11 +53,11 @@ In `options`, hash should be like this:
53
53
 
54
54
  ```ruby
55
55
  {
56
- "Name" => {
57
- type: :string,
58
- required: true,
59
- description: "The description of the command."
60
- }
56
+ "Name" => {
57
+ type: :string,
58
+ required: true,
59
+ description: "The description of the command."
60
+ }
61
61
  }
62
62
  ```
63
63
 
@@ -73,19 +73,19 @@ In `options`, hash should be like this:
73
73
 
74
74
  ```ruby
75
75
  {
76
- "vocaloid" => {
77
- required: true,
78
- description: "The vocaloid which you like.",
79
- type: :string,
80
- choices: {
81
- "Hatsune Miku" => "miku",
82
- "Kagamine Rin" => "rin",
83
- "Kagamine Len" => "len",
84
- "Megurine Luka" => "luka",
85
- "MEIKO" => "meiko",
86
- "KAITO" => "kaito",
87
- }
76
+ "vocaloid" => {
77
+ required: true,
78
+ description: "The vocaloid which you like.",
79
+ type: :string,
80
+ choices: {
81
+ "Hatsune Miku" => "miku",
82
+ "Kagamine Rin" => "rin",
83
+ "Kagamine Len" => "len",
84
+ "Megurine Luka" => "luka",
85
+ "MEIKO" => "meiko",
86
+ "KAITO" => "kaito",
88
87
  }
88
+ }
89
89
  }
90
90
 
91
91
  # Note: This aritcle is written in 8/31.
@@ -113,22 +113,47 @@ To register a group of slash commands, use {Discorb::Command::Handler#slash_grou
113
113
  group = client.slash_group("settings", "Set settings of bot.")
114
114
 
115
115
  group.slash("message_expand", "Whether bot should expand message.", {
116
- "enabled" => {
117
- type: :boolean,
118
- description: "Whether bot should expand message."
119
- }
116
+ "enabled" => {
117
+ type: :boolean,
118
+ description: "Whether bot should expand message."
119
+ }
120
120
  }) do |interaction|
121
121
  # ...
122
122
  end
123
123
 
124
124
  group.slash("bump_alert", "Whether bot should notify DISBOARD bump.", {
125
- "enabled" => {
126
- type: :boolean,
127
- description: "Whether bot should notify DISBOARD bump."
128
- }
125
+ "enabled" => {
126
+ type: :boolean,
127
+ description: "Whether bot should notify DISBOARD bump."
128
+ }
129
129
  }) do |interaction|
130
130
  # ...
131
131
  end
132
+
133
+ ```
134
+
135
+ Since v0.5.1, You can use block for register commands.
136
+
137
+ ```ruby
138
+
139
+ client.slash_group("settings", "Set settings of bot.") do
140
+ slash("message_expand", "Whether bot should expand message.", {
141
+ "enabled" => {
142
+ type: :boolean,
143
+ description: "Whether bot should expand message."
144
+ }
145
+ }) do |interaction|
146
+ # ...
147
+ end
148
+ slash("bump_alert", "Whether bot should notify DISBOARD bump.", {
149
+ "enabled" => {
150
+ type: :boolean,
151
+ description: "Whether bot should notify DISBOARD bump."
152
+ }
153
+ }) do |interaction|
154
+ # ...
155
+ end
156
+ end
132
157
  ```
133
158
 
134
159
  You can make subcommand group by using {Discorb::Command::Command::GroupCommand#group}.
@@ -210,6 +235,8 @@ end
210
235
 
211
236
  ```
212
237
 
238
+ Same as above, you can use block for register commands since v0.5.1.
239
+
213
240
  ### Register User Context Menu Command
214
241
 
215
242
  ```ruby
data/docs/events.md CHANGED
@@ -219,14 +219,13 @@ Fires when a guild integration is created.
219
219
  | ---------- | ----- | ----------- |
220
220
  |`integration`| {Discorb::Integration}| The created integration. |
221
221
 
222
- #### `integration_update(before, after)`
222
+ #### `integration_update(after)`
223
223
 
224
224
  Fires when a guild integration is updated.
225
225
 
226
226
 
227
227
  | Parameter | Type | Description |
228
228
  | ---------- | ----- | ----------- |
229
- |`before` | {Discorb::Integration}| The integration before the update. |
230
229
  |`after` | {Discorb::Integration}| The integration after the update. |
231
230
 
232
231
  #### `integration_delete(integration)`
data/docs/extension.md CHANGED
@@ -34,6 +34,33 @@ module MyExtension
34
34
  end
35
35
  ```
36
36
 
37
+ ## Register Command
38
+
39
+ Since v0.5.2, {Discorb::Extension} includes {Discorb::Command::Handler} module, so you can register command with {Discorb::Command::Handler#slash} and {Discorb::Command::Handler#slash_group}.
40
+
41
+ ```ruby
42
+ module MyExtension
43
+ extend Discorb::Extension
44
+
45
+ slash("command", "Command") do |interaction|
46
+ # ...
47
+ end
48
+
49
+ slash_group("group", "Group") do
50
+ slash("subcommand", "Subcommand") do |interaction|
51
+ # ...
52
+ end
53
+
54
+ group("subgroup", "Subcommand group") do
55
+ slash("group_subcommand", "Command in Subcommand group") do |interaction|
56
+ # ...
57
+ end
58
+ end
59
+ end
60
+ end
61
+ ```
62
+
63
+
37
64
  ## Load extension
38
65
 
39
66
  Use {Discorb::Client#extend} to load extension.
@@ -636,7 +636,6 @@ module Discorb
636
636
 
637
637
  #
638
638
  # Represents a voice channel.
639
- # @todo Implement connecting to voice channel.
640
639
  #
641
640
  class VoiceChannel < GuildChannel
642
641
  # @return [Integer] The bitrate of the voice channel.
@@ -645,6 +644,8 @@ module Discorb
645
644
  # @return [nil] If the user limit is not set.
646
645
  attr_reader :user_limit
647
646
 
647
+ include Connectable
648
+
648
649
  @channel_type = 2
649
650
  #
650
651
  # Edit the voice channel.
@@ -699,6 +700,8 @@ module Discorb
699
700
  # @!visibility private
700
701
  attr_reader :stage_instances
701
702
 
703
+ include Connectable
704
+
702
705
  # @!attribute [r] stage_instance
703
706
  # @return [Discorb::StageInstance] The stage instance of the channel.
704
707
 
@@ -49,6 +49,10 @@ module Discorb
49
49
  attr_reader :ping
50
50
  # @return [:initialized, :running, :closed] The status of the client.
51
51
  attr_reader :status
52
+ # @return [Integer] The session ID of connection.
53
+ attr_reader :session_id
54
+ # @private
55
+ attr_reader :bottom_commands
52
56
 
53
57
  #
54
58
  # Initializes a new client.
@@ -85,6 +89,7 @@ module Discorb
85
89
  @tasks = []
86
90
  @conditions = {}
87
91
  @commands = []
92
+ @bottom_commands = []
88
93
  @status = :initialized
89
94
  end
90
95
 
@@ -372,6 +377,14 @@ module Discorb
372
377
  @events[name] << event
373
378
  end
374
379
  end
380
+ @commands.delete_if do |cmd|
381
+ cmd.respond_to? :extension and cmd.extension == mod.name
382
+ end
383
+ mod.commands.each do |cmd|
384
+ cmd.define_singleton_method(:extension) { mod.name }
385
+ @commands << cmd
386
+ end
387
+ @bottom_commands += mod.bottom_commands
375
388
  mod.client = self
376
389
  end
377
390
  super(mod)
@@ -422,7 +435,7 @@ module Discorb
422
435
  end
423
436
  end
424
437
  start_client(token)
425
- when "setup_command"
438
+ when "setup"
426
439
  setup_commands(token)
427
440
  end
428
441
  end
@@ -34,6 +34,7 @@ module Discorb
34
34
  def slash(command_name, description, options = {}, guild_ids: [], &block)
35
35
  command = Discorb::Command::Command::SlashCommand.new(command_name, description, options, guild_ids, block, 1, "")
36
36
  @commands << command
37
+ @bottom_commands << command
37
38
  command
38
39
  end
39
40
 
@@ -44,12 +45,16 @@ module Discorb
44
45
  # @param [String] description Command description.
45
46
  # @param [Array<#to_s>] guild_ids Guild IDs to restrict the command to.
46
47
  #
48
+ # @yield Block to execute as the command. It can be used to define sub-commands.
49
+ # @yieldself [Discorb::Command::Command::GroupCommand] Group command.
50
+ #
47
51
  # @return [Discorb::Command::Command::GroupCommand] Command object.
48
52
  #
49
53
  # @see file:docs/slash_command.md
50
54
  #
51
- def slash_group(command_name, description, guild_ids: [])
52
- command = Discorb::Command::Command::GroupCommand.new(command_name, description, guild_ids, nil)
55
+ def slash_group(command_name, description, guild_ids: [], &block)
56
+ command = Discorb::Command::Command::GroupCommand.new(command_name, description, guild_ids, nil, self)
57
+ command.instance_eval(&block) if block_given?
53
58
  @commands << command
54
59
  command
55
60
  end
@@ -174,6 +179,7 @@ module Discorb
174
179
  @guild_ids = guild_ids.map(&:to_s)
175
180
  @block = block
176
181
  @type = Discorb::Command::Command.types[type]
182
+ @type_raw = 1
177
183
  @options = options
178
184
  @id = nil
179
185
  @parent = parent
@@ -241,10 +247,11 @@ module Discorb
241
247
  attr_reader :description
242
248
 
243
249
  # @!visibility private
244
- def initialize(name, description, guild_ids, type)
250
+ def initialize(name, description, guild_ids, type, client)
245
251
  super(name, guild_ids, block, type)
246
252
  @description = description
247
253
  @commands = []
254
+ @client = client
248
255
  @id_map = Discorb::Dictionary.new
249
256
  end
250
257
 
@@ -256,42 +263,7 @@ module Discorb
256
263
  #
257
264
  def slash(command_name, description, options = {}, &block)
258
265
  command = Discorb::Command::Command::SlashCommand.new(command_name, description, options, [], block, 1, @name)
259
- options_payload = options.map do |name, value|
260
- ret = {
261
- type: case (value[:type].is_a?(Array) ? value[:type].first : value[:type])
262
- when String, :string
263
- 3
264
- when Integer
265
- 4
266
- when TrueClass, FalseClass, :boolean
267
- 5
268
- when Discorb::User, Discorb::Member, :user, :member
269
- 6
270
- when Discorb::Channel, :channel
271
- 7
272
- when Discorb::Role, :role
273
- 8
274
- when :mentionable
275
- 9
276
- when Float
277
- 10
278
- end,
279
- name: name,
280
- description: value[:description],
281
- required: !value[:optional],
282
- }
283
- if value[:type].is_a?(Array)
284
- ret[:choices] = value[:type]
285
- end
286
-
287
- ret
288
- end
289
- {
290
- name: @name,
291
- default_permission: true,
292
- description: @description,
293
- options: options_payload,
294
- }
266
+ @client.bottom_commands << command
295
267
  @commands << command
296
268
  command
297
269
  end
@@ -302,12 +274,16 @@ module Discorb
302
274
  # @param [String] command_name Group name.
303
275
  # @param [String] description Group description.
304
276
  #
277
+ # @yield Block to execute as the command. It can be used to define sub-commands.
278
+ # @yieldself [Discorb::Command::Command::SubcommandGroup] Group command.
279
+ #
305
280
  # @return [Discorb::Command::Command::SubcommandGroup] Command object.
306
281
  #
307
282
  # @see file:docs/slash_command.md
308
283
  #
309
- def group(command_name, description)
310
- command = Discorb::Command::Command::SubcommandGroup.new(command_name, description, @name)
284
+ def group(command_name, description, &block)
285
+ command = Discorb::Command::Command::SubcommandGroup.new(command_name, description, @name, @client)
286
+ command.instance_eval(&block) if block_given?
311
287
  @commands << command
312
288
  command
313
289
  end
@@ -328,7 +304,7 @@ module Discorb
328
304
  {
329
305
  name: command.name,
330
306
  description: command.description,
331
- default_permission: command.enabled,
307
+ default_permission: true,
332
308
  type: 1,
333
309
  options: command.to_hash[:options],
334
310
  }
@@ -336,7 +312,7 @@ module Discorb
336
312
  {
337
313
  name: command.name,
338
314
  description: command.description,
339
- default_permission: command.enabled,
315
+ default_permission: true,
340
316
  type: 2,
341
317
  options: command.commands.map { |c| c.to_hash.merge(type: 1) },
342
318
  }
@@ -360,8 +336,8 @@ module Discorb
360
336
  attr_reader :commands
361
337
 
362
338
  # @!visibility private
363
- def initialize(name, description, enabled, parent)
364
- super(name, description, [], enabled, 1)
339
+ def initialize(name, description, parent, client)
340
+ super(name, description, [], 1, client)
365
341
 
366
342
  @commands = []
367
343
  @parent = parent
@@ -376,9 +352,10 @@ module Discorb
376
352
  # @param (see Discorb::Command::Handler#slash)
377
353
  # @return [Discorb::Command::Command::SlashCommand] The added subcommand.
378
354
  #
379
- def slash(command_name, description, options = {}, enabled: true, &block)
380
- command = Discorb::Command::Command::SlashCommand.new(command_name, description, options, [], enabled, block, 1, @parent + " " + @name)
355
+ def slash(command_name, description, options = {}, &block)
356
+ command = Discorb::Command::Command::SlashCommand.new(command_name, description, options, [], block, 1, @parent + " " + @name)
381
357
  @commands << command
358
+ @client.bottom_commands << command
382
359
  command
383
360
  end
384
361
  end
@@ -4,7 +4,7 @@ module Discorb
4
4
  # @return [String] The API base URL.
5
5
  API_BASE_URL = "https://discord.com/api/v9"
6
6
  # @return [String] The version of discorb.
7
- VERSION = "0.5.0"
7
+ VERSION = "0.5.4"
8
8
  # @return [String] The user agent for the bot.
9
9
  USER_AGENT = "DiscordBot (https://github.com/discorb-lib/discorb #{VERSION}) Ruby/#{RUBY_VERSION}"
10
10
 
@@ -8,6 +8,9 @@ module Discorb
8
8
  # @abstract
9
9
  #
10
10
  module Extension
11
+ include Discorb::Command::Handler
12
+ undef setup_commands
13
+
11
14
  @events = {}
12
15
  @client = nil
13
16
 
@@ -46,12 +49,18 @@ module Discorb
46
49
 
47
50
  # @return [Hash{Symbol => Array<Discorb::Event>}] The events of the extension.
48
51
  attr_reader :events
52
+ # @return [Array<Discorb::Command::Command] The commands of the extension.
53
+ attr_reader :commands
54
+ # @private
55
+ attr_reader :bottom_commands
49
56
 
50
57
  # @!visibility private
51
58
  attr_accessor :client
52
59
 
53
60
  def self.extended(obj)
54
61
  obj.instance_variable_set(:@events, {})
62
+ obj.instance_variable_set(:@commands, [])
63
+ obj.instance_variable_set(:@bottom_commands, [])
55
64
  end
56
65
  end
57
66
  end
@@ -545,7 +545,7 @@ module Discorb
545
545
  connect_gateway(true)
546
546
  end
547
547
  when 11
548
- @log.info "Received opcode 11"
548
+ @log.debug "Received opcode 11"
549
549
  @ping = Time.now.to_f - @heartbeat_before
550
550
  when 0
551
551
  handle_event(payload[:t], data)
@@ -778,11 +778,9 @@ module Discorb
778
778
  dispatch(:integration_create, Integration.new(self, data, data[:guild_id]))
779
779
  when "INTEGRATION_UPDATE"
780
780
  return @log.warn "Unknown guild id #{data[:guild_id]}, ignoring" unless (guild = @guilds[data[:guild_id]])
781
- return @log.warn "Unknown integration id #{data[:id]}, ignoring" unless (integration = guild.integrations[data[:id]])
782
781
 
783
- before = Integration.new(self, integration.instance_variable_get(:@data), data[:guild_id], no_cache: true)
784
- integration.send(:_set_data, data)
785
- dispatch(:integration_update, before, integration)
782
+ before = Integration.new(self, data, data[:guild_id])
783
+ dispatch(:integration_update, integration)
786
784
  when "INTEGRATION_DELETE"
787
785
  return @log.warn "Unknown guild id #{data[:guild_id]}, ignoring" unless (guild = @guilds[data[:guild_id]])
788
786
  return @log.warn "Unknown integration id #{data[:id]}, ignoring" unless (integration = guild.integrations.delete(data[:id]))
@@ -979,7 +977,11 @@ module Discorb
979
977
  @log.info("Successfully resumed connection")
980
978
  dispatch(:resumed)
981
979
  else
982
- @log.warn "Unknown event: #{event_name}\n#{data.inspect}"
980
+ if respond_to?("event_" + event_name.downcase)
981
+ __send__("event_" + event_name.downcase, data)
982
+ else
983
+ @log.debug "Received unknown event: #{event_name}\n#{data.inspect}"
984
+ end
983
985
  end
984
986
  end
985
987
  end
data/lib/discorb/http.rb CHANGED
@@ -5,7 +5,7 @@ require "net/https"
5
5
  module Discorb
6
6
  #
7
7
  # A class to handle http requests.
8
- # This class is internal use only.
8
+ # @private
9
9
  #
10
10
  class HTTP
11
11
  @nil_body = nil
@@ -297,7 +297,7 @@ module Discorb
297
297
  end
298
298
  end
299
299
 
300
- unless (command = @client.commands.find { |c| c.to_s == name })
300
+ unless (command = @client.bottom_commands.find { |c| c.to_s == name && c.type_raw == 1 })
301
301
  @client.log.warn "Unknown command name #{name}, ignoreing"
302
302
  next
303
303
  end
@@ -393,7 +393,7 @@ module Discorb
393
393
  # @!visibility private
394
394
  def make_interaction(client, data)
395
395
  nested_classes.each do |klass|
396
- return klass.new(client, data) if !klass.component_type.nil? && klass.component_type == data[:type]
396
+ return klass.new(client, data) if !klass.component_type.nil? && klass.component_type == data[:data][:component_type]
397
397
  end
398
398
  client.log.warn("Unknown component type #{data[:component_type]}, initialized Interaction")
399
399
  MessageComponentInteraction.new(client, data)
@@ -208,4 +208,14 @@ module Discorb
208
208
  end
209
209
  end
210
210
  end
211
+
212
+ #
213
+ # Module for connecting to a voice channel.
214
+ # This will be discord-voice gem.
215
+ #
216
+ module Connectable
217
+ def connect
218
+ raise NotImplementedError, "This method is implemented by discord-voice gem."
219
+ end
220
+ end
211
221
  end
@@ -3,14 +3,22 @@
3
3
  module Discorb
4
4
  #
5
5
  # Class to handle rate limiting.
6
+ # @private
6
7
  #
7
8
  class RatelimitHandler
9
+ # @!visibility private
8
10
  def initialize(client)
9
11
  @client = client
10
12
  @ratelimit_hash = {}
11
13
  @path_ratelimit_hash = {}
12
14
  end
13
15
 
16
+ #
17
+ # Wait for the rate limit to reset.
18
+ #
19
+ # @param [String] method The HTTP method.
20
+ # @param [String] path The path.
21
+ #
14
22
  def wait(method, path)
15
23
  return if path.start_with?("https://")
16
24
 
@@ -28,6 +36,13 @@ module Discorb
28
36
  sleep(b[:reset_at] - Time.now.to_i)
29
37
  end
30
38
 
39
+ #
40
+ # Save the rate limit.
41
+ #
42
+ # @param [String] method The HTTP method.
43
+ # @param [String] path The path.
44
+ # @param [Net::HTTPResponse] resp The response.
45
+ #
31
46
  def save(method, path, resp)
32
47
  return unless resp["X-RateLimit-Remaining"]
33
48
 
data/lib/discorb/user.rb CHANGED
@@ -78,7 +78,7 @@ module Discorb
78
78
  Async do
79
79
  next @dm_channel_id if @dm_channel_id
80
80
 
81
- dm_channel = @client.http.post("/users/#{@id}/channels", { recipient_id: @client.user.id }).wait
81
+ _resp, dm_channel = @client.http.post("/users/@me/channels", { recipient_id: @id }).wait
82
82
  @dm_channel_id = dm_channel[:id]
83
83
  @dm_channel_id
84
84
  end
data/lib/discorb.rb CHANGED
@@ -41,11 +41,11 @@ end
41
41
 
42
42
  require_order = %w[common flag dictionary error rate_limit http intents emoji_table modules] +
43
43
  %w[user member guild emoji channel embed message] +
44
- %w[application audit_logs color components event extension] +
44
+ %w[application audit_logs color components event] +
45
45
  %w[file guild_template image integration interaction invite log permission] +
46
46
  %w[presence reaction role sticker utils voice_state webhook] +
47
47
  %w[gateway_requests gateway command] +
48
- %w[asset client extend]
48
+ %w[asset extension client extend]
49
49
  require_order.each do |name|
50
50
  require_relative "discorb/#{name}.rb"
51
51
  end
@@ -421,7 +421,7 @@ code[class=""] {
421
421
 
422
422
  .docstring .abstract {
423
423
  --dstr-back: var(--background-modifier-hover);
424
- --dstr-fore: var(--interactive-hover);
424
+ --dstr-fore: var(--interactive-muted);
425
425
  }
426
426
 
427
427
  .docstring .note {
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.5.0
4
+ version: 0.5.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: 2021-09-10 00:00:00.000000000 Z
11
+ date: 2021-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async