discorb 0.5.6 → 0.6.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 +7 -0
- data/Gemfile.lock +1 -1
- data/docs/cli/run.md +11 -1
- data/docs/cli/setup.md +7 -1
- data/lib/discorb/channel.rb +18 -18
- data/lib/discorb/client.rb +20 -9
- data/lib/discorb/command.rb +33 -23
- data/lib/discorb/common.rb +1 -1
- data/lib/discorb/emoji.rb +2 -2
- data/lib/discorb/error.rb +6 -0
- data/lib/discorb/exe/run.rb +12 -0
- data/lib/discorb/exe/setup.rb +14 -1
- data/lib/discorb/extension.rb +1 -1
- data/lib/discorb/gateway.rb +9 -4
- data/lib/discorb/guild.rb +38 -38
- data/lib/discorb/http.rb +13 -11
- data/lib/discorb/interaction.rb +2 -2
- data/lib/discorb/member.rb +1 -1
- data/lib/discorb/message.rb +5 -5
- data/lib/discorb/modules.rb +5 -5
- data/lib/discorb/user.rb +1 -1
- data/lib/discorb/webhook.rb +1 -1
- data/sig/discorb.rbs +7218 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aec8518b5159a98382c8f9ddcc4ca5818e0be6e364ef5e8d2a623e8395b5f078
|
4
|
+
data.tar.gz: 4b93ab7afc612c550e19a8d7ba1fac48f0613b760f38bcd1ba2b4387e20b2435
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b73524dd2de6c337d42ad82f83c95d960e936ad554ebf6fb9cad6c96b06d4779b862339d319d2d0d42ba498ce6cfa536f5adc48eb801bb42e1ba4dd133c72976
|
7
|
+
data.tar.gz: 1ff54afd40c0731e2726236d18633bd1a9039ae4c98129765f64a0d96f4491cf282f3f4a9872a195d20403160dcdab4ed0832d923533462f088694015bcf5dc9
|
data/Changelog.md
CHANGED
@@ -138,3 +138,10 @@
|
|
138
138
|
- Add: Raise error when intents are invalid
|
139
139
|
- Fix: Fix Emoji#==
|
140
140
|
|
141
|
+
## 0.6.0
|
142
|
+
|
143
|
+
- Fix: Fix issue with client with no guilds
|
144
|
+
- Add: Add rbs (experimental)
|
145
|
+
- Add: Add `-t`, `--token` option to `discorb run`
|
146
|
+
- Add: Add `-g`, `--guild` option to `discorb setup`
|
147
|
+
- Change: Use `Async::Task<R>` instead of `R` in return value
|
data/Gemfile.lock
CHANGED
data/docs/cli/run.md
CHANGED
@@ -17,6 +17,8 @@ discorb run [options] [script]
|
|
17
17
|
|
18
18
|
The script to run. Defaults to `main.rb`.
|
19
19
|
|
20
|
+
### Options
|
21
|
+
|
20
22
|
#### `-d`, `--deamon`
|
21
23
|
|
22
24
|
Run the client in deamon mode.
|
@@ -43,4 +45,12 @@ You can use `stdout` to write to the standard output, and `stderr` to write to t
|
|
43
45
|
Whether to colorize the log output.
|
44
46
|
If not specified, the default will be:
|
45
47
|
- `true` if the file to write logs to is `stdout` or `stderr`.
|
46
|
-
- `false` otherwise.
|
48
|
+
- `false` otherwise.
|
49
|
+
|
50
|
+
#### `-s`, `--setup`
|
51
|
+
|
52
|
+
Whether to setup application commands.
|
53
|
+
|
54
|
+
#### `-t`, `--token`
|
55
|
+
|
56
|
+
The name of the environment variable to use for token, or just `-t` or `--token` for intractive prompt.
|
data/docs/cli/setup.md
CHANGED
@@ -7,7 +7,7 @@ This command will setup application commands.
|
|
7
7
|
## Usage
|
8
8
|
|
9
9
|
```
|
10
|
-
discorb setup [script]
|
10
|
+
discorb setup [options] [script]
|
11
11
|
```
|
12
12
|
|
13
13
|
### Arguments
|
@@ -15,3 +15,9 @@ discorb setup [script]
|
|
15
15
|
#### `script`
|
16
16
|
|
17
17
|
The script to setup. Defaults to `main.rb`.
|
18
|
+
|
19
|
+
### Options
|
20
|
+
|
21
|
+
#### `-g`, `--guild`
|
22
|
+
|
23
|
+
Guild IDs to use as default. Can be specified multiple IDs by using `,` as delimiter.
|
data/lib/discorb/channel.rb
CHANGED
@@ -171,7 +171,7 @@ module Discorb
|
|
171
171
|
#
|
172
172
|
# @param [String] reason The reason of deleting the channel.
|
173
173
|
#
|
174
|
-
# @return [self] The deleted channel.
|
174
|
+
# @return [Async::Task<self>] The deleted channel.
|
175
175
|
#
|
176
176
|
def delete!(reason: nil)
|
177
177
|
Async do
|
@@ -194,7 +194,7 @@ module Discorb
|
|
194
194
|
# @param [Discorb::CategoryChannel] parent The parent of channel.
|
195
195
|
# @param [String] reason The reason of moving the channel.
|
196
196
|
#
|
197
|
-
# @return [self] The moved channel.
|
197
|
+
# @return [Async::Task<self>] The moved channel.
|
198
198
|
#
|
199
199
|
def move(position, lock_permissions: false, parent: :unset, reason: nil)
|
200
200
|
Async do
|
@@ -273,7 +273,7 @@ module Discorb
|
|
273
273
|
# @param [Integer] archive_in Alias of `default_auto_archive_duration`.
|
274
274
|
# @param [String] reason The reason of editing the channel.
|
275
275
|
#
|
276
|
-
# @return [self] The edited channel.
|
276
|
+
# @return [Async::Task<self>] The edited channel.
|
277
277
|
#
|
278
278
|
def edit(name: :unset, position: :unset, category: :unset, parent: :unset,
|
279
279
|
topic: :unset, nsfw: :unset, announce: :unset,
|
@@ -310,7 +310,7 @@ module Discorb
|
|
310
310
|
# @param [String] name The name of the webhook.
|
311
311
|
# @param [Discorb::Image] avatar The avatar of the webhook.
|
312
312
|
#
|
313
|
-
# @return [Discorb::Webhook::IncomingWebhook] The created webhook.
|
313
|
+
# @return [Async::Task<Discorb::Webhook::IncomingWebhook>] The created webhook.
|
314
314
|
#
|
315
315
|
def create_webhook(name, avatar: nil)
|
316
316
|
Async do
|
@@ -327,7 +327,7 @@ module Discorb
|
|
327
327
|
# @macro async
|
328
328
|
# @macro http
|
329
329
|
#
|
330
|
-
# @return [Array<Discorb::Webhook
|
330
|
+
# @return [Async::Task<Array<Discorb::Webhook>>] The webhooks in the channel.
|
331
331
|
#
|
332
332
|
def fetch_webhooks
|
333
333
|
Async do
|
@@ -419,7 +419,7 @@ module Discorb
|
|
419
419
|
# @macro async
|
420
420
|
# @macro http
|
421
421
|
#
|
422
|
-
# @return [Array<Discorb::Invite
|
422
|
+
# @return [Async::Task<Array<Discorb::Invite>>] The invites in the channel.
|
423
423
|
#
|
424
424
|
def fetch_invites
|
425
425
|
Async do
|
@@ -440,7 +440,7 @@ module Discorb
|
|
440
440
|
# @note if it's `false` it may return existing invite.
|
441
441
|
# @param [String] reason The reason of creating the invite.
|
442
442
|
#
|
443
|
-
# @return [Invite] The created invite.
|
443
|
+
# @return [Async::Task<Invite>] The created invite.
|
444
444
|
#
|
445
445
|
def create_invite(max_age: nil, max_uses: nil, temporary: false, unique: false, reason: nil)
|
446
446
|
Async do
|
@@ -487,7 +487,7 @@ module Discorb
|
|
487
487
|
# @macro async
|
488
488
|
# @macro http
|
489
489
|
#
|
490
|
-
# @return [Array<Discorb::Message
|
490
|
+
# @return [Async::Task<Array<Discorb::Message>>] The pinned messages in the channel.
|
491
491
|
#
|
492
492
|
def fetch_pins
|
493
493
|
Async do
|
@@ -535,7 +535,7 @@ module Discorb
|
|
535
535
|
# @param [Boolean] public Whether the thread is public.
|
536
536
|
# @param [String] reason The reason of starting the thread.
|
537
537
|
#
|
538
|
-
# @return [Discorb::ThreadChannel] The started thread.
|
538
|
+
# @return [Async::Task<Discorb::ThreadChannel>] The started thread.
|
539
539
|
#
|
540
540
|
def start_thread(name, message: nil, auto_archive_duration: 1440, public: true, reason: nil)
|
541
541
|
Async do
|
@@ -560,7 +560,7 @@ module Discorb
|
|
560
560
|
# @macro async
|
561
561
|
# @macro http
|
562
562
|
#
|
563
|
-
# @return [Array<Discorb::ThreadChannel
|
563
|
+
# @return [Async::Task<Array<Discorb::ThreadChannel>>] The archived threads in the channel.
|
564
564
|
#
|
565
565
|
def fetch_archived_public_threads
|
566
566
|
Async do
|
@@ -574,7 +574,7 @@ module Discorb
|
|
574
574
|
# @macro async
|
575
575
|
# @macro http
|
576
576
|
#
|
577
|
-
# @return [Array<Discorb::ThreadChannel
|
577
|
+
# @return [Async::Task<Array<Discorb::ThreadChannel>>] The archived private threads in the channel.
|
578
578
|
#
|
579
579
|
def fetch_archived_private_threads
|
580
580
|
Async do
|
@@ -591,7 +591,7 @@ module Discorb
|
|
591
591
|
# @param [Integer] limit The limit of threads to fetch.
|
592
592
|
# @param [Time] before <description>
|
593
593
|
#
|
594
|
-
# @return [Array<Discorb::ThreadChannel
|
594
|
+
# @return [Async::Task<Array<Discorb::ThreadChannel>>] The joined archived private threads in the channel.
|
595
595
|
#
|
596
596
|
def fetch_joined_archived_private_threads(limit: nil, before: nil)
|
597
597
|
Async do
|
@@ -660,7 +660,7 @@ module Discorb
|
|
660
660
|
# @param [Symbol] rtc_region The region of the voice channel.
|
661
661
|
# @param [String] reason The reason of editing the voice channel.
|
662
662
|
#
|
663
|
-
# @return [self] The edited voice channel.
|
663
|
+
# @return [Async::Task<self>] The edited voice channel.
|
664
664
|
#
|
665
665
|
def edit(name: :unset, position: :unset, bitrate: :unset, user_limit: :unset, rtc_region: :unset, reason: nil)
|
666
666
|
Async do
|
@@ -728,7 +728,7 @@ module Discorb
|
|
728
728
|
# @param [Symbol] rtc_region The region of the stage channel.
|
729
729
|
# @param [String] reason The reason of editing the stage channel.
|
730
730
|
#
|
731
|
-
# @return [self] The edited stage channel.
|
731
|
+
# @return [Async::Task<self>] The edited stage channel.
|
732
732
|
#
|
733
733
|
def edit(name: :unset, position: :unset, bitrate: :unset, rtc_region: :unset, reason: nil)
|
734
734
|
Async do
|
@@ -753,7 +753,7 @@ module Discorb
|
|
753
753
|
# @param [Boolean] public Whether the stage instance is public or not.
|
754
754
|
# @param [String] reason The reason of starting the stage instance.
|
755
755
|
#
|
756
|
-
# @return [Discorb::StageInstance] The started stage instance.
|
756
|
+
# @return [Async::Task<Discorb::StageInstance>] The started stage instance.
|
757
757
|
#
|
758
758
|
def start(topic, public: false, reason: nil)
|
759
759
|
Async do
|
@@ -767,8 +767,8 @@ module Discorb
|
|
767
767
|
# @macro async
|
768
768
|
# @macro http
|
769
769
|
#
|
770
|
-
# @return [StageInstance] The current stage instance.
|
771
|
-
# @return [nil] If there is no current stage instance.
|
770
|
+
# @return [Async::Task<StageInstance>] The current stage instance.
|
771
|
+
# @return [Async::Task<nil>] If there is no current stage instance.
|
772
772
|
#
|
773
773
|
def fetch_stage_instance
|
774
774
|
Async do
|
@@ -853,7 +853,7 @@ module Discorb
|
|
853
853
|
# @param [Boolean] locked Whether the thread is locked or not.
|
854
854
|
# @param [String] reason The reason of editing the thread.
|
855
855
|
#
|
856
|
-
# @return [self] The edited thread.
|
856
|
+
# @return [Async::Task<self>] The edited thread.
|
857
857
|
#
|
858
858
|
# @see #archive
|
859
859
|
# @see #lock
|
data/lib/discorb/client.rb
CHANGED
@@ -202,7 +202,7 @@ module Discorb
|
|
202
202
|
#
|
203
203
|
# @param [#to_s] id <description>
|
204
204
|
#
|
205
|
-
# @return [Discorb::User] The user.
|
205
|
+
# @return [Async::Task<Discorb::User>] The user.
|
206
206
|
#
|
207
207
|
# @raise [Discorb::NotFoundError] If the user doesn't exist.
|
208
208
|
#
|
@@ -220,7 +220,7 @@ module Discorb
|
|
220
220
|
#
|
221
221
|
# @param [#to_s] id The ID of the channel.
|
222
222
|
#
|
223
|
-
# @return [Discorb::Channel] The channel.
|
223
|
+
# @return [Async::Task<Discorb::Channel>] The channel.
|
224
224
|
#
|
225
225
|
# @raise [Discorb::NotFoundError] If the channel doesn't exist.
|
226
226
|
#
|
@@ -238,7 +238,7 @@ module Discorb
|
|
238
238
|
#
|
239
239
|
# @param [#to_s] id <description>
|
240
240
|
#
|
241
|
-
# @return [Discorb::Guild] The guild.
|
241
|
+
# @return [Async::Task<Discorb::Guild>] The guild.
|
242
242
|
#
|
243
243
|
# @raise [Discorb::NotFoundError] If the guild doesn't exist.
|
244
244
|
#
|
@@ -258,7 +258,7 @@ module Discorb
|
|
258
258
|
# @param [Boolean] with_count Whether to include the count of the invite.
|
259
259
|
# @param [Boolean] with_expiration Whether to include the expiration of the invite.
|
260
260
|
#
|
261
|
-
# @return [Discorb::Invite] The invite.
|
261
|
+
# @return [Async::Task<Discorb::Invite>] The invite.
|
262
262
|
#
|
263
263
|
def fetch_invite(code, with_count: false, with_expiration: false)
|
264
264
|
Async do
|
@@ -275,7 +275,7 @@ module Discorb
|
|
275
275
|
#
|
276
276
|
# @param [Boolean] force Whether to force the fetch.
|
277
277
|
#
|
278
|
-
# @return [Discorb::Application] The application.
|
278
|
+
# @return [Async::Task<Discorb::Application>] The application.
|
279
279
|
#
|
280
280
|
def fetch_application(force: false)
|
281
281
|
Async do
|
@@ -292,7 +292,7 @@ module Discorb
|
|
292
292
|
# @macro async
|
293
293
|
# @macro http
|
294
294
|
#
|
295
|
-
# @return [Array<Discorb::Sticker::Pack
|
295
|
+
# @return [Async::Task<Array<Discorb::Sticker::Pack>>] The packs.
|
296
296
|
#
|
297
297
|
def fetch_nitro_sticker_packs
|
298
298
|
Async do
|
@@ -398,9 +398,13 @@ module Discorb
|
|
398
398
|
# @note This method behavior will change by CLI.
|
399
399
|
# @see file:docs/cli.md
|
400
400
|
#
|
401
|
-
# @param [String] token The token to use.
|
401
|
+
# @param [String, nil] token The token to use.
|
402
402
|
#
|
403
|
-
|
403
|
+
# @note If the token is nil, you should use `discorb run` with the `-t` or `--token` option.
|
404
|
+
#
|
405
|
+
def run(token = nil)
|
406
|
+
token ||= ENV["DISCORB_CLI_TOKEN"]
|
407
|
+
raise ArgumentError, "Token is not specified, and -t/--token is not specified" if token.nil?
|
404
408
|
case ENV["DISCORB_CLI_FLAG"]
|
405
409
|
when nil
|
406
410
|
start_client(token)
|
@@ -436,7 +440,14 @@ module Discorb
|
|
436
440
|
end
|
437
441
|
start_client(token)
|
438
442
|
when "setup"
|
439
|
-
|
443
|
+
guild_ids = "global"
|
444
|
+
if guilds = ENV["DISCORB_SETUP_GUILDS"]
|
445
|
+
guild_ids = guilds.split(",")
|
446
|
+
end
|
447
|
+
if guild_ids == ["global"]
|
448
|
+
guild_ids = false
|
449
|
+
end
|
450
|
+
setup_commands(token, guild_ids: guild_ids).wait
|
440
451
|
end
|
441
452
|
end
|
442
453
|
|
data/lib/discorb/command.rb
CHANGED
@@ -24,14 +24,15 @@ module Discorb
|
|
24
24
|
# | `:type` | `Object` | Type of the option. |
|
25
25
|
# | `:choice` | `Hash{String => String, Integer, Float}` | Type of the option. |
|
26
26
|
#
|
27
|
-
# @param [Array<#to_s
|
27
|
+
# @param [Array<#to_s>, false, nil] guild_ids Guild IDs to set the command to. `false` to global command, `nil` to use default.
|
28
28
|
# @param [Proc] block Command block.
|
29
29
|
#
|
30
30
|
# @return [Discorb::Command::Command::SlashCommand]
|
31
31
|
#
|
32
32
|
# @see file:docs/application_command.md#register-slash-command
|
33
|
+
# @see file:docs/cli/setup.md
|
33
34
|
#
|
34
|
-
def slash(command_name, description, options = {}, guild_ids:
|
35
|
+
def slash(command_name, description, options = {}, guild_ids: nil, &block)
|
35
36
|
command = Discorb::Command::Command::SlashCommand.new(command_name, description, options, guild_ids, block, 1, "")
|
36
37
|
@commands << command
|
37
38
|
@bottom_commands << command
|
@@ -43,7 +44,7 @@ module Discorb
|
|
43
44
|
#
|
44
45
|
# @param [String] command_name Command name.
|
45
46
|
# @param [String] description Command description.
|
46
|
-
# @param [Array<#to_s
|
47
|
+
# @param [Array<#to_s>, false, nil] guild_ids Guild IDs to set the command to. `false` to global command, `nil` to use default.
|
47
48
|
#
|
48
49
|
# @yield Block to execute as the command. It can be used to define sub-commands.
|
49
50
|
# @yieldself [Discorb::Command::Command::GroupCommand] Group command.
|
@@ -51,8 +52,9 @@ module Discorb
|
|
51
52
|
# @return [Discorb::Command::Command::GroupCommand] Command object.
|
52
53
|
#
|
53
54
|
# @see file:docs/slash_command.md
|
55
|
+
# @see file:docs/cli/setup.md
|
54
56
|
#
|
55
|
-
def slash_group(command_name, description, guild_ids:
|
57
|
+
def slash_group(command_name, description, guild_ids: nil, &block)
|
56
58
|
command = Discorb::Command::Command::GroupCommand.new(command_name, description, guild_ids, nil, self)
|
57
59
|
command.instance_eval(&block) if block_given?
|
58
60
|
@commands << command
|
@@ -63,15 +65,15 @@ module Discorb
|
|
63
65
|
# Add message context menu command.
|
64
66
|
#
|
65
67
|
# @param [String] command_name Command name.
|
66
|
-
# @param [Array<#to_s
|
68
|
+
# @param [Array<#to_s>, false, nil] guild_ids Guild IDs to set the command to. `false` to global command, `nil` to use default.
|
67
69
|
# @param [Proc] block Command block.
|
68
70
|
# @yield [interaction, message] Block to execute.
|
69
|
-
# @yieldparam [Discorb::CommandInteraction::UserMenuCommand] Interaction object.
|
70
|
-
# @yieldparam [Discorb::Message]
|
71
|
+
# @yieldparam [Discorb::CommandInteraction::UserMenuCommand] interaction Interaction object.
|
72
|
+
# @yieldparam [Discorb::Message] message Message object.
|
71
73
|
#
|
72
74
|
# @return [Discorb::Command::Command] Command object.
|
73
75
|
#
|
74
|
-
def message_command(command_name, guild_ids:
|
76
|
+
def message_command(command_name, guild_ids: nil, &block)
|
75
77
|
command = Discorb::Command::Command.new(command_name, guild_ids, block, 3)
|
76
78
|
@commands << command
|
77
79
|
command
|
@@ -81,15 +83,15 @@ module Discorb
|
|
81
83
|
# Add user context menu command.
|
82
84
|
#
|
83
85
|
# @param [String] command_name Command name.
|
84
|
-
# @param [Array<#to_s
|
86
|
+
# @param [Array<#to_s>, false, nil] guild_ids Guild IDs to set the command to. `false` to global command, `nil` to use default.
|
85
87
|
# @param [Proc] block Command block.
|
86
88
|
# @yield [interaction, user] Block to execute.
|
87
|
-
# @yieldparam [Discorb::CommandInteraction::UserMenuCommand] Interaction object.
|
89
|
+
# @yieldparam [Discorb::CommandInteraction::UserMenuCommand] interaction Interaction object.
|
88
90
|
# @yieldparam [Discorb::User] user User object.
|
89
91
|
#
|
90
92
|
# @return [Discorb::Command::Command] Command object.
|
91
93
|
#
|
92
|
-
def user_command(command_name, guild_ids:
|
94
|
+
def user_command(command_name, guild_ids: nil, &block)
|
93
95
|
command = Discorb::Command::Command.new(command_name, guild_ids, block, 2)
|
94
96
|
@commands << command
|
95
97
|
command
|
@@ -100,20 +102,32 @@ module Discorb
|
|
100
102
|
# @see Client#initialize
|
101
103
|
#
|
102
104
|
# @param [String] token Bot token.
|
105
|
+
# @param [Array<#to_s>, false, nil] guild_ids Guild IDs to use as default. If `false` is given, it will be global command.
|
106
|
+
#
|
103
107
|
# @note `token` parameter only required if you don't run client.
|
104
108
|
#
|
105
|
-
def setup_commands(token = nil)
|
109
|
+
def setup_commands(token = nil, guild_ids: nil)
|
106
110
|
Async do
|
107
111
|
@token ||= token
|
108
112
|
@http = HTTP.new(self)
|
109
|
-
global_commands = @commands.select { |c| c.guild_ids.
|
110
|
-
|
113
|
+
global_commands = @commands.select { |c| c.guild_ids == false or c.guild_ids == [] }
|
114
|
+
local_commands = @commands.select { |c| c.guild_ids.is_a?(Array) and c.guild_ids.any? }
|
115
|
+
default_commands = @commands.select { |c| c.guild_ids.nil? }
|
116
|
+
if guild_ids.is_a?(Array)
|
117
|
+
default_commands.each do |command|
|
118
|
+
command.instance_variable_set(:@guild_ids, guild_ids)
|
119
|
+
end
|
120
|
+
local_commands += default_commands
|
121
|
+
else
|
122
|
+
global_commands += default_commands
|
123
|
+
end
|
124
|
+
final_guild_ids = local_commands.map(&:guild_ids).flatten.map(&:to_s).uniq
|
111
125
|
app_info = fetch_application.wait
|
112
126
|
http.put("/applications/#{app_info.id}/commands", global_commands.map(&:to_hash)).wait unless global_commands.empty?
|
113
|
-
|
114
|
-
commands =
|
127
|
+
final_guild_ids.each do |guild_id|
|
128
|
+
commands = local_commands.select { |c| c.guild_ids.include?(guild_id) }
|
115
129
|
http.put("/applications/#{app_info.id}/guilds/#{guild_id}/commands", commands.map(&:to_hash)).wait
|
116
|
-
end unless
|
130
|
+
end unless final_guild_ids.empty?
|
117
131
|
@log.info "Successfully setup commands"
|
118
132
|
end
|
119
133
|
end
|
@@ -146,7 +160,7 @@ module Discorb
|
|
146
160
|
# @!visibility private
|
147
161
|
def initialize(name, guild_ids, block, type)
|
148
162
|
@name = name
|
149
|
-
@guild_ids = guild_ids
|
163
|
+
@guild_ids = guild_ids&.map(&:to_s)
|
150
164
|
@block = block
|
151
165
|
@raw_type = type
|
152
166
|
@type = Discorb::Command::Command.types[type]
|
@@ -174,12 +188,8 @@ module Discorb
|
|
174
188
|
|
175
189
|
# @!visibility private
|
176
190
|
def initialize(name, description, options, guild_ids, block, type, parent)
|
191
|
+
super(name, guild_ids, block, type)
|
177
192
|
@description = description
|
178
|
-
@name = name
|
179
|
-
@guild_ids = guild_ids.map(&:to_s)
|
180
|
-
@block = block
|
181
|
-
@type = Discorb::Command::Command.types[type]
|
182
|
-
@type_raw = 1
|
183
193
|
@options = options
|
184
194
|
@id = nil
|
185
195
|
@parent = parent
|
data/lib/discorb/common.rb
CHANGED
@@ -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.
|
7
|
+
VERSION = "0.6.0"
|
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
|
|