discorb 0.18.0 → 0.18.1

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: 117db5f0857b3da9f0c3a642da5c012b0e6b458aa61c2590b31df28540f04732
4
- data.tar.gz: '08b41acb91e31536970e4a8545f7b29a656ea50fbc813eecde02463acff31cb1'
3
+ metadata.gz: 5d310d54f09cb9be975ba75c37a717b159f3f4b2996686a5f40b7b86329657ab
4
+ data.tar.gz: 81ed8d1d40aa4bb851e018c56672e24d8346ee2c3544d44ebc48a5583e6b6b46
5
5
  SHA512:
6
- metadata.gz: 511b7faf125d98e9da7120fe7a3dfae5f224dfcb4891e989cab8183db22ebd0f569685e3e7a7f00040d9ee539d5efaa5fa178f10a0137f79b155026944560a2e
7
- data.tar.gz: 86ced549c50cc26a3a512964614587ff74690b67ed64810355fb307081407b87083151903febfe5f6fb634918365d88e1171af09070b1dbb838c5bcb0a31b9b5
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
@@ -99,7 +99,8 @@ end
99
99
  client.run(ENV["DISCORD_BOT_TOKEN"])
100
100
  ```
101
101
 
102
- Note you must run `discorb setup` before using slash commands.
102
+ > **Note**
103
+ > You must run `discorb setup` before using slash commands.
103
104
 
104
105
  ## Contributing
105
106
 
@@ -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:
@@ -195,6 +195,10 @@ module Discorb
195
195
  ret[:min_value] = value[:range].begin
196
196
  ret[:max_value] = value[:range].end
197
197
  end
198
+ if value[:length]
199
+ ret[:min_length] = value[:length].begin
200
+ ret[:max_length] = value[:length].end
201
+ end
198
202
  ret
199
203
  end
200
204
  {
@@ -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.
@@ -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.0"
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.0
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-06-26 00:00:00.000000000 Z
11
+ date: 2022-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async