discorb 0.18.0 → 0.18.1
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 +6 -0
- data/README.md +2 -1
- data/docs/application_command.md +1 -0
- data/lib/discorb/app_command/command.rb +4 -0
- data/lib/discorb/app_command/handler.rb +1 -0
- data/lib/discorb/common.rb +1 -1
- data/lib/discorb/interaction/root.rb +3 -0
- data/sig/discorb/app_command/base.rbs +1 -1
- data/sig/discorb/interaction/base.rbs +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d310d54f09cb9be975ba75c37a717b159f3f4b2996686a5f40b7b86329657ab
|
4
|
+
data.tar.gz: 81ed8d1d40aa4bb851e018c56672e24d8346ee2c3544d44ebc48a5583e6b6b46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: feed366d2ae2614f6c08a891f697245304047a4a1447fd2e5cdbed17829aea950e4b8fb6677b70e993bd613c6be3f1db880061f4fa77024bae6ce4caaf11683c
|
7
|
+
data.tar.gz: 5be8aa8414d67a58cf591f87b13b2ae5d0d8f17de8dc6399d9ef370967c79e39400596192e3ebb016934e36c69c2aae4dc19b0b0c4e86eb0903ddfb5e5495902
|
data/Changelog.md
CHANGED
@@ -6,6 +6,12 @@
|
|
6
6
|
|
7
7
|
## v0.18
|
8
8
|
|
9
|
+
### v0.18.1
|
10
|
+
|
11
|
+
- Add: Support `:length` option for `:string` type.
|
12
|
+
- Add: Add `Interaction#app_permissions`
|
13
|
+
- Fix: Fix typing of `:autocomplete` option.
|
14
|
+
|
9
15
|
### v0.18.0
|
10
16
|
|
11
17
|
- Change!: `XXX#fired_by` is now `XXX#user` or `XXX#member`.
|
data/README.md
CHANGED
data/docs/application_command.md
CHANGED
@@ -82,6 +82,7 @@ In `options`, hash should be like this:
|
|
82
82
|
| `:channel_types` | `Array<Class<Discorb::Channel>>` | Type of the channel option. |
|
83
83
|
| `:autocomplete` | `Proc` | Autocomplete function. |
|
84
84
|
| `:range` | `Range` | Range of the option. Only valid for numeric options. (`:int`, `:float`) |
|
85
|
+
| `:length` | `Range` | Range of length of the option. Only valid for `:string`. |
|
85
86
|
|
86
87
|
`choices` should be unspecified if you don't want to use it.
|
87
88
|
`choices` example:
|
@@ -39,6 +39,7 @@ module Discorb
|
|
39
39
|
# | `:channel_types` | `Array<Class<Discorb::Channel>>` | Type of the channel option. |
|
40
40
|
# | `:autocomplete` | `Proc` | Autocomplete function. |
|
41
41
|
# | `:range` | `Range` | Range of the option. Only valid for numeric options. (`:int`, `:float`) |
|
42
|
+
# | `:length` | `Range` | Range of length of the option. Only valid for `:string`. |
|
42
43
|
#
|
43
44
|
# @param [Array<#to_s>, false, nil] guild_ids
|
44
45
|
# Guild IDs to set the command to. `false` to global command, `nil` to use default.
|
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/v10"
|
6
6
|
# @return [String] The version of discorb.
|
7
|
-
VERSION = "0.18.
|
7
|
+
VERSION = "0.18.1"
|
8
8
|
# @return [Array<Integer>] The version array of discorb.
|
9
9
|
VERSION_ARRAY = VERSION.split(".").map(&:to_i).freeze
|
10
10
|
# @return [String] The user agent for the bot.
|
@@ -25,6 +25,8 @@ module Discorb
|
|
25
25
|
# @return [Symbol] The locale of the guild that created the interaction.
|
26
26
|
# @note This modifies the language code, `-` will be replaced with `_`.
|
27
27
|
attr_reader :guild_locale
|
28
|
+
# @return [Discorb::Permission] The permissions of the bot.
|
29
|
+
attr_reader :app_permissions
|
28
30
|
|
29
31
|
# @!attribute [r] guild
|
30
32
|
# @macro client_cache
|
@@ -62,6 +64,7 @@ module Discorb
|
|
62
64
|
@token = data[:token]
|
63
65
|
@locale = data[:locale].to_s.gsub("-", "_").to_sym
|
64
66
|
@guild_locale = data[:guild_locale].to_s.gsub("-", "_").to_sym
|
67
|
+
@app_permissions = data[:app_permissions] && Permission.new(data[:app_permissions].to_i)
|
65
68
|
@version = data[:version]
|
66
69
|
@defered = false
|
67
70
|
@responded = false
|
@@ -35,7 +35,7 @@ module Discorb
|
|
35
35
|
choices: Hash[String, (String | Integer | Float)]?,
|
36
36
|
choices_localizations: Hash[String, Hash[(Symbol | String), String]]?,
|
37
37
|
channel_types: Array[Class]?,
|
38
|
-
autocomplete: ^(Discorb::CommandInteraction) -> Hash[String, String]?,
|
38
|
+
autocomplete: (^(Discorb::CommandInteraction) -> Hash[String, String])?,
|
39
39
|
range: Range[(Integer | Float)]?
|
40
40
|
}
|
41
41
|
type options = ::Hash[String, option]
|
@@ -62,5 +62,8 @@ module Discorb
|
|
62
62
|
# @return [Symbol] The locale of the guild that created the interaction.
|
63
63
|
# @note This modifies the language code, `-` will be replaced with `_`.
|
64
64
|
attr_reader guild_locale: Symbol
|
65
|
+
|
66
|
+
# @return [Discorb::Permission] The permissions of the bot.
|
67
|
+
attr_reader app_permissions: Discorb::Permission
|
65
68
|
end
|
66
69
|
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.18.
|
4
|
+
version: 0.18.1
|
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-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|