discorb 0.12.0 → 0.12.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/PULL_REQUEST_TEMPLATE.md +30 -0
- data/CONTRIBUTING.md +25 -0
- data/Changelog.md +21 -0
- data/discorb.gemspec +1 -1
- data/docs/application_command.md +1 -0
- data/docs/cli/run.md +2 -1
- data/lib/discorb/app_command.rb +5 -0
- data/lib/discorb/client.rb +2 -2
- data/lib/discorb/common.rb +1 -1
- data/lib/discorb/emoji_table.rb +3891 -3806
- data/lib/discorb/exe/run.rb +16 -1
- data/lib/discorb/http.rb +11 -4
- data/lib/discorb/integration.rb +1 -1
- data/lib/discorb/interaction/autocomplete.rb +1 -1
- data/lib/discorb/interaction/command.rb +2 -2
- data/lib/discorb/message.rb +25 -23
- data/lib/discorb/user.rb +7 -0
- data/template-replace/scripts/yard_replace.rb +6 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb6441bf1c3ae4d181aa1a6048b72bc60bea0d0894e1da00c79a2648dd59c13e
|
4
|
+
data.tar.gz: 835bb57c283b00f9e4863f026f6500ddd81345d51f3b1482ac1c68e23f3debdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1af485b0c8476e5e538c70d146ef2819587148a813a31d55cefe7d727e6060462b9e063ab8eb7fad8e1249d0e6d77214a65d4aa7b8843e149b38bc4c21d588b4
|
7
|
+
data.tar.gz: f50a9468ceed0d21e753867a5c42177022792a1550477272843d1a26fa5339d59b3b2c0cf1493edc84627856258aea05a8342531fc620b27c02c149e696169a2
|
@@ -0,0 +1,30 @@
|
|
1
|
+
## What does this PR do?
|
2
|
+
|
3
|
+
<!--
|
4
|
+
Please describe the changes you are making (be as descriptive as possible).
|
5
|
+
Ex: Fix `Foo#bar`
|
6
|
+
Add `Hoge#fuga`
|
7
|
+
-->
|
8
|
+
|
9
|
+
## Information
|
10
|
+
|
11
|
+
- [ ] This PR fixes an issue.
|
12
|
+
- [ ] This PR adds a new feature.
|
13
|
+
- [ ] This PR refactors code.
|
14
|
+
- [ ] This PR has breaking changes.
|
15
|
+
- [ ] This PR **won't** change the behavior of the code. (e.g. documentation)
|
16
|
+
<!-- If you need to add more information, please add it here. -->
|
17
|
+
|
18
|
+
|
19
|
+
## Checklist
|
20
|
+
|
21
|
+
- [ ] I have reviewed the code and it is clean and well documented.
|
22
|
+
- [ ] I have ran bot and it is working as expected.
|
23
|
+
- [ ] I have updated the document.
|
24
|
+
|
25
|
+
## Related issues
|
26
|
+
|
27
|
+
<!--
|
28
|
+
If there are any related issues, please add them here.
|
29
|
+
If there are no related issues, please write `None`.
|
30
|
+
-->
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Contributing to the project
|
2
|
+
|
3
|
+
## Submitting a bug report
|
4
|
+
|
5
|
+
Please follow these steps to report a bug:
|
6
|
+
1. Check if the bug already exists in issue tracker. Don't forget to search closed issues too.
|
7
|
+
2. Create issue from [the template](https://github.com/discorb-lib/discorb/issues/new?assignees=&labels=bug&template=bug_report.md).
|
8
|
+
3. Fill in the issue with the information about the bug.
|
9
|
+
4. Submit the issue.
|
10
|
+
|
11
|
+
## Submitting a feature request
|
12
|
+
|
13
|
+
Please follow these steps to request a feature:
|
14
|
+
1. Check if the feature already exists in main branch.
|
15
|
+
2. Check if the request already exists in issue tracker. Don't forget to search closed issues too.
|
16
|
+
3. Create issue from [the template](https://github.com/discorb-lib/discorb/issues/new?assignees=&labels=Feature+Request%2CEnhancement&template=feature_request.md).
|
17
|
+
4. Fill in the issue with the information about the feature.
|
18
|
+
5. Submit the issue.
|
19
|
+
|
20
|
+
## Submitting a pull request
|
21
|
+
|
22
|
+
Please follow these steps to request a pull request:
|
23
|
+
1. Check if the thing you want to request already exists in main branch.
|
24
|
+
2. Check if the request already exists and is merged or closed.
|
25
|
+
3. [Create a pull request](https://github.com/discorb-lib/discorb/compare).
|
data/Changelog.md
CHANGED
@@ -4,6 +4,27 @@
|
|
4
4
|
|
5
5
|
## v0.12
|
6
6
|
|
7
|
+
### v0.12.4
|
8
|
+
|
9
|
+
- Update: Update emoji table
|
10
|
+
- Add: Support min_value and max_value for numeric options in slash command
|
11
|
+
- Fix: Fix sending images
|
12
|
+
|
13
|
+
### v0.12.3
|
14
|
+
|
15
|
+
- Fix: Fix NoMethodError in command interaction
|
16
|
+
- Fix: Fix NoMethodError in Integration#initialize
|
17
|
+
|
18
|
+
### v0.12.2
|
19
|
+
|
20
|
+
- Fix: Fix `Message#type`
|
21
|
+
- Change: `discorb run` will lookup for `main.rb` in parent directories
|
22
|
+
|
23
|
+
### v0.12.1
|
24
|
+
|
25
|
+
- Fix: Fix some texts
|
26
|
+
- Add: Add `User#mention`
|
27
|
+
|
7
28
|
### v0.12.0
|
8
29
|
|
9
30
|
- Refactor: Refactor the code
|
data/discorb.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["sevenc-nanashi"]
|
9
9
|
spec.email = ["sevenc-nanashi@sevenbot.jp"]
|
10
10
|
|
11
|
-
spec.summary = "
|
11
|
+
spec.summary = "A discord API wrapper written in Ruby"
|
12
12
|
spec.homepage = "https://github.com/discorb-lib/discorb"
|
13
13
|
spec.license = "MIT"
|
14
14
|
spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
|
data/docs/application_command.md
CHANGED
@@ -70,6 +70,7 @@ In `options`, hash should be like this:
|
|
70
70
|
| `:default` | `Object` | Default value of the option. |
|
71
71
|
| `:channel_types` | `Array<Class<Discorb::Channel>>` | Type of the channel option. |
|
72
72
|
| `:autocomplete` | `Proc` | Autocomplete function. |
|
73
|
+
| `:range` | `Range` | Range of the option. Only valid for numeric options. (`:int`, `:float`) |
|
73
74
|
|
74
75
|
`choices` should be unspecified if you don't want to use it.
|
75
76
|
`choices` is hash like this:
|
data/docs/cli/run.md
CHANGED
@@ -16,6 +16,7 @@ discorb run [options] [script]
|
|
16
16
|
#### `script`
|
17
17
|
|
18
18
|
The script to run. Defaults to `main.rb`.
|
19
|
+
If the script wasn't specified, it will also look for a file named `main.rb` in the parent directories, like rake.
|
19
20
|
|
20
21
|
### Options
|
21
22
|
|
@@ -57,4 +58,4 @@ The name of the environment variable to use for token, or just `-t` or `--token`
|
|
57
58
|
|
58
59
|
#### `-b`, `--bundler`
|
59
60
|
|
60
|
-
Whether to use bundler to load the script.
|
61
|
+
Whether to use bundler to load the script.
|
data/lib/discorb/app_command.rb
CHANGED
@@ -27,6 +27,7 @@ module Discorb
|
|
27
27
|
# | `:default` | `Object` | Default value of the option. |
|
28
28
|
# | `:channel_types` | `Array<Class<Discorb::Channel>>` | Type of the channel option. |
|
29
29
|
# | `:autocomplete` | `Proc` | Autocomplete function. |
|
30
|
+
# | `:range` | `Range` | Range of the option. Only valid for numeric options. (`:int`, `:float`) |
|
30
31
|
#
|
31
32
|
# @param [Array<#to_s>, false, nil] guild_ids Guild IDs to set the command to. `false` to global command, `nil` to use default.
|
32
33
|
# @param [Proc] block Command block.
|
@@ -251,6 +252,10 @@ module Discorb
|
|
251
252
|
ret[:channel_types] = value[:channel_types].map(&:channel_type) if value[:channel_types]
|
252
253
|
|
253
254
|
ret[:autocomplete] = !!value[:autocomplete] if value[:autocomplete]
|
255
|
+
if value[:range]
|
256
|
+
ret[:min_value] = value[:range].begin
|
257
|
+
ret[:max_value] = value[:range].end
|
258
|
+
end
|
254
259
|
ret
|
255
260
|
end
|
256
261
|
{
|
data/lib/discorb/client.rb
CHANGED
@@ -420,11 +420,11 @@ module Discorb
|
|
420
420
|
#
|
421
421
|
# @param [String, nil] token The token to use.
|
422
422
|
#
|
423
|
-
# @note If the token is nil, you should use `discorb run` with the `-
|
423
|
+
# @note If the token is nil, you should use `discorb run` with the `-e` or `--env` option.
|
424
424
|
#
|
425
425
|
def run(token = nil)
|
426
426
|
token ||= ENV["DISCORB_CLI_TOKEN"]
|
427
|
-
raise ArgumentError, "Token is not specified, and -
|
427
|
+
raise ArgumentError, "Token is not specified, and -e/--env is not specified" if token.nil?
|
428
428
|
case ENV["DISCORB_CLI_FLAG"]
|
429
429
|
when nil
|
430
430
|
start_client(token)
|
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.12.
|
7
|
+
VERSION = "0.12.4"
|
8
8
|
# @return [String] The user agent for the bot.
|
9
9
|
USER_AGENT = "DiscordBot (https://discorb-lib.github.io #{VERSION}) Ruby/#{RUBY_VERSION}"
|
10
10
|
|