discorb 0.16.0 → 0.17.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/.gitattributes +1 -0
- data/.github/workflows/build_main.yml +2 -2
- data/.github/workflows/build_version.yml +1 -1
- data/.github/workflows/codeql-analysis.yml +1 -1
- data/.github/workflows/lint-push.yml +3 -5
- data/.github/workflows/lint.yml +1 -1
- data/.github/workflows/spec.yml +30 -0
- data/.lefthook/commit-msg/validator.rb +5 -0
- data/.rspec +2 -0
- data/.rspec_parallel +2 -0
- data/.rubocop.yml +43 -6
- data/Changelog.md +14 -1
- data/Gemfile +14 -8
- data/Rakefile +41 -26
- data/bin/console +3 -3
- data/docs/Examples.md +1 -1
- data/docs/application_command.md +138 -46
- data/docs/cli/irb.md +2 -2
- data/docs/cli/new.md +14 -9
- data/docs/cli/run.md +7 -11
- data/docs/cli.md +17 -10
- data/docs/events.md +209 -211
- data/docs/extension.md +1 -2
- data/docs/faq.md +0 -1
- data/docs/tutorial.md +12 -12
- data/docs/voice_events.md +106 -106
- data/examples/commands/message.rb +63 -0
- data/examples/commands/permission.rb +18 -0
- data/examples/commands/slash.rb +44 -0
- data/examples/commands/user.rb +51 -0
- data/examples/components/authorization_button.rb +2 -2
- data/examples/components/select_menu.rb +2 -2
- data/examples/extension/main.rb +1 -1
- data/examples/extension/message_expander.rb +5 -2
- data/examples/simple/eval.rb +2 -2
- data/examples/simple/ping_pong.rb +1 -1
- data/examples/simple/rolepanel.rb +1 -1
- data/examples/simple/shard.rb +1 -1
- data/examples/simple/wait_for_message.rb +1 -1
- data/exe/discorb +31 -16
- data/lefthook.yml +45 -0
- data/lib/discorb/allowed_mentions.rb +1 -0
- data/lib/discorb/app_command/command.rb +127 -65
- data/lib/discorb/app_command/common.rb +25 -0
- data/lib/discorb/app_command/handler.rb +115 -33
- data/lib/discorb/app_command.rb +2 -1
- data/lib/discorb/application.rb +1 -0
- data/lib/discorb/asset.rb +1 -2
- data/lib/discorb/attachment.rb +1 -1
- data/lib/discorb/audit_logs.rb +11 -8
- data/lib/discorb/channel/base.rb +108 -0
- data/lib/discorb/channel/category.rb +32 -0
- data/lib/discorb/channel/container.rb +44 -0
- data/lib/discorb/channel/dm.rb +28 -0
- data/lib/discorb/channel/guild.rb +245 -0
- data/lib/discorb/channel/stage.rb +140 -0
- data/lib/discorb/channel/text.rb +345 -0
- data/lib/discorb/channel/thread.rb +321 -0
- data/lib/discorb/channel/voice.rb +79 -0
- data/lib/discorb/channel.rb +2 -1165
- data/lib/discorb/client.rb +38 -26
- data/lib/discorb/common.rb +2 -1
- data/lib/discorb/components/button.rb +2 -1
- data/lib/discorb/components/select_menu.rb +4 -2
- data/lib/discorb/components/text_input.rb +12 -2
- data/lib/discorb/components.rb +1 -1
- data/lib/discorb/embed.rb +22 -7
- data/lib/discorb/emoji.rb +30 -3
- data/lib/discorb/emoji_table.rb +4969 -3
- data/lib/discorb/event.rb +29 -4
- data/lib/discorb/exe/about.rb +1 -0
- data/lib/discorb/exe/irb.rb +2 -4
- data/lib/discorb/exe/new.rb +90 -23
- data/lib/discorb/exe/run.rb +8 -22
- data/lib/discorb/exe/setup.rb +25 -12
- data/lib/discorb/exe/show.rb +4 -3
- data/lib/discorb/extend.rb +1 -0
- data/lib/discorb/extension.rb +6 -3
- data/lib/discorb/flag.rb +11 -0
- data/lib/discorb/gateway.rb +67 -19
- data/lib/discorb/guild.rb +188 -56
- data/lib/discorb/guild_template.rb +10 -4
- data/lib/discorb/http.rb +16 -9
- data/lib/discorb/integration.rb +4 -1
- data/lib/discorb/intents.rb +1 -1
- data/lib/discorb/interaction/autocomplete.rb +28 -16
- data/lib/discorb/interaction/command.rb +36 -12
- data/lib/discorb/interaction/components.rb +5 -2
- data/lib/discorb/interaction/modal.rb +0 -1
- data/lib/discorb/interaction/response.rb +61 -22
- data/lib/discorb/interaction/root.rb +13 -13
- data/lib/discorb/interaction.rb +1 -0
- data/lib/discorb/invite.rb +5 -2
- data/lib/discorb/member.rb +25 -5
- data/lib/discorb/message.rb +47 -14
- data/lib/discorb/message_meta.rb +1 -0
- data/lib/discorb/modules.rb +56 -14
- data/lib/discorb/presence.rb +2 -2
- data/lib/discorb/rate_limit.rb +7 -2
- data/lib/discorb/reaction.rb +4 -4
- data/lib/discorb/role.rb +19 -4
- data/lib/discorb/shard.rb +1 -1
- data/lib/discorb/sticker.rb +8 -7
- data/lib/discorb/user.rb +2 -1
- data/lib/discorb/utils/colored_puts.rb +1 -0
- data/lib/discorb/voice_state.rb +10 -6
- data/lib/discorb/webhook.rb +36 -24
- data/lib/discorb.rb +5 -3
- data/po/yard.pot +9 -9
- data/sig/discorb.rbs +7232 -7235
- metadata +21 -5
- data/examples/commands/bookmarker.rb +0 -42
- data/examples/commands/hello.rb +0 -10
- data/examples/commands/inspect.rb +0 -25
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a56213c17efa8d538ddacbbe14f5d4d32b787384e02d21cf925aa0855db59e3
|
|
4
|
+
data.tar.gz: a3fce194d0f243b931d3918553880656e0bac5b0228d2ccd7147cae1068e1c9b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aaced769a9309ab29050fdd89aed3164d7dbfe67e31dba2dd6caf91c83e5b6a16b00a941edc591a529619b13fdc0ec498e0cdfdda07c21849feece7c46a63a06
|
|
7
|
+
data.tar.gz: 205d12c8f88eabd03de31bf9a184e84653727ebb0acc8d05daabe8f3b0e41273665855ecdf8a8456e40cdcefc64c537b756efbaf48c6dbe413ea6a1b10cd7375
|
data/.gitattributes
CHANGED
|
@@ -3,7 +3,7 @@ name: Build YARD with main
|
|
|
3
3
|
on:
|
|
4
4
|
workflow_dispatch:
|
|
5
5
|
schedule:
|
|
6
|
-
- cron: "
|
|
6
|
+
- cron: "0 * * * *"
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
9
|
main:
|
|
@@ -11,7 +11,7 @@ jobs:
|
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
|
|
13
13
|
steps:
|
|
14
|
-
- uses: actions/checkout@
|
|
14
|
+
- uses: actions/checkout@v3
|
|
15
15
|
with:
|
|
16
16
|
fetch-depth: 0
|
|
17
17
|
- name: Set up Ruby
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
name: Lint with RuboCop
|
|
2
2
|
on:
|
|
3
3
|
push:
|
|
4
|
-
branches:
|
|
5
|
-
- main
|
|
6
4
|
jobs:
|
|
7
5
|
rubocop:
|
|
8
6
|
runs-on: ubuntu-latest
|
|
9
7
|
steps:
|
|
10
8
|
- name: Checkout repository
|
|
11
|
-
uses: actions/checkout@
|
|
9
|
+
uses: actions/checkout@v3
|
|
12
10
|
- uses: ruby/setup-ruby@v1
|
|
13
11
|
with:
|
|
14
12
|
ruby-version: 3.0.0
|
|
15
13
|
- name: Install gems
|
|
16
14
|
run: |
|
|
17
|
-
|
|
15
|
+
bundle install
|
|
18
16
|
- name: Run rubocop
|
|
19
17
|
run: |
|
|
20
|
-
|
|
18
|
+
rake lint
|
data/.github/workflows/lint.yml
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Run spec
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
main:
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
ruby-version:
|
|
14
|
+
- "3.0"
|
|
15
|
+
- "3.1"
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- name: Set up Ruby
|
|
19
|
+
uses: ruby/setup-ruby@v1
|
|
20
|
+
with:
|
|
21
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
22
|
+
bundler-cache: true
|
|
23
|
+
- name: Checkout repository
|
|
24
|
+
uses: actions/checkout@v3
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: |
|
|
27
|
+
bundle install
|
|
28
|
+
gem update uri
|
|
29
|
+
- name: Run spec
|
|
30
|
+
run: bundle exec rake spec
|
data/.rspec
ADDED
data/.rspec_parallel
ADDED
data/.rubocop.yml
CHANGED
|
@@ -2,13 +2,38 @@ AllCops:
|
|
|
2
2
|
NewCops: enable
|
|
3
3
|
TargetRubyVersion: 3.0
|
|
4
4
|
Exclude:
|
|
5
|
-
-
|
|
5
|
+
- lib/discorb/emoji_table.rb
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
require:
|
|
8
|
+
- rubocop-rake
|
|
9
|
+
- rubocop-rspec
|
|
10
|
+
|
|
11
|
+
# Layout:
|
|
12
|
+
# Enabled: false
|
|
9
13
|
Metrics:
|
|
10
14
|
Enabled: false
|
|
11
15
|
|
|
16
|
+
Layout/EndOfLine:
|
|
17
|
+
EnforcedStyle: lf
|
|
18
|
+
|
|
19
|
+
Layout/IndentationWidth:
|
|
20
|
+
AllowedPatterns: ['if']
|
|
21
|
+
|
|
22
|
+
Layout/HeredocIndentation:
|
|
23
|
+
Enabled: false
|
|
24
|
+
|
|
25
|
+
Layout/ClosingHeredocIndentation:
|
|
26
|
+
Enabled: false
|
|
27
|
+
|
|
28
|
+
Layout/CaseIndentation:
|
|
29
|
+
Enabled: false
|
|
30
|
+
|
|
31
|
+
Layout/ElseAlignment:
|
|
32
|
+
Enabled: false
|
|
33
|
+
|
|
34
|
+
Layout/EndAlignment:
|
|
35
|
+
Enabled: false
|
|
36
|
+
|
|
12
37
|
Style/TrailingCommaInHashLiteral: # Disabled for rufo
|
|
13
38
|
EnforcedStyleForMultiline: consistent_comma
|
|
14
39
|
|
|
@@ -25,6 +50,9 @@ Style/TrailingCommaInArguments: # Disabled for rufo
|
|
|
25
50
|
Style/StringLiteralsInInterpolation: # Disabled for rufo
|
|
26
51
|
Enabled: false
|
|
27
52
|
|
|
53
|
+
Layout/SpaceAroundOperators: # Changed for rufo
|
|
54
|
+
EnforcedStyleForExponentOperator: space
|
|
55
|
+
|
|
28
56
|
Style/StringConcatenation: # + looks better
|
|
29
57
|
Enabled: false
|
|
30
58
|
|
|
@@ -67,8 +95,17 @@ Lint/Debugger: # For /exe
|
|
|
67
95
|
Style/GuardClause: # For make it extendable
|
|
68
96
|
Enabled: false
|
|
69
97
|
|
|
70
|
-
Layout/EndOfLine: # For git
|
|
71
|
-
EnforcedStyle: lf
|
|
72
|
-
|
|
73
98
|
Lint/ScriptPermission: # For GitHub Actions
|
|
99
|
+
Enabled: false
|
|
100
|
+
|
|
101
|
+
Style/NumericLiterals: # For style
|
|
102
|
+
Enabled: false
|
|
103
|
+
|
|
104
|
+
RSpec/FilePath:
|
|
105
|
+
Enabled: false
|
|
106
|
+
|
|
107
|
+
RSpec/ExampleLength:
|
|
108
|
+
Enabled: false
|
|
109
|
+
|
|
110
|
+
RSpec/MultipleExpectations:
|
|
74
111
|
Enabled: false
|
data/Changelog.md
CHANGED
|
@@ -4,6 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
# Changelog
|
|
6
6
|
|
|
7
|
+
## v0.17
|
|
8
|
+
|
|
9
|
+
### v0.17.0
|
|
10
|
+
|
|
11
|
+
- Change!: Delete `Interaction#target` and `Interaction#fired_by`.
|
|
12
|
+
- Change: `Interaction#user` and `Interaction#member` are same.
|
|
13
|
+
- Add: Include Messageable in VoiceChannel
|
|
14
|
+
- Add: Add `--[no-]bundler` option to `discorb` command.
|
|
15
|
+
- Add: Add `--[no-]comment` option to `discorb new` command.
|
|
16
|
+
- Fix PermissionOverwrite was initialized with string.
|
|
17
|
+
- Fix emoji with different skin tones raises ArgumentError.
|
|
18
|
+
- Fix `Asset#endpoint` raises NameError.
|
|
19
|
+
- Fix `:error` event may call itself.
|
|
20
|
+
|
|
7
21
|
## v0.16
|
|
8
22
|
|
|
9
23
|
### v0.16.0
|
|
@@ -456,4 +470,3 @@ end
|
|
|
456
470
|
### v0.0.1
|
|
457
471
|
|
|
458
472
|
- Initial release
|
|
459
|
-
|
data/Gemfile
CHANGED
|
@@ -7,10 +7,20 @@ gemspec
|
|
|
7
7
|
|
|
8
8
|
gem "rake", "~> 13.0"
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
# Rubocop
|
|
11
|
+
gem "rubocop", "~> 1.25"
|
|
12
|
+
gem "rubocop-rake", "~> 0.6.0"
|
|
13
|
+
gem "rubocop-rspec", "~> 2.9"
|
|
14
|
+
|
|
15
|
+
# RSpec
|
|
16
|
+
gem "async-rspec", "~> 1.16"
|
|
17
|
+
gem "parallel_tests", "~> 3.8"
|
|
18
|
+
gem "rspec", "~> 3.11"
|
|
19
|
+
|
|
20
|
+
# Other development tools
|
|
21
|
+
gem "lefthook", "~> 0.7.7"
|
|
22
|
+
gem "rufo", "~> 0.13.0"
|
|
23
|
+
gem "sord", "~> 3.0.1"
|
|
14
24
|
|
|
15
25
|
group :docs, optional: true do
|
|
16
26
|
gem "crowdin-api", "~> 1.0"
|
|
@@ -19,7 +29,3 @@ group :docs, optional: true do
|
|
|
19
29
|
gem "rubyzip", "~> 2.3"
|
|
20
30
|
gem "yard", "~> 0.9.26"
|
|
21
31
|
end
|
|
22
|
-
|
|
23
|
-
group :lint, optional: true do
|
|
24
|
-
gem "rubocop", "~> 1.25"
|
|
25
|
-
end
|
data/Rakefile
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "bundler/gem_tasks"
|
|
4
4
|
require_relative "lib/discorb/utils/colored_puts"
|
|
5
|
+
require "parallel_tests"
|
|
5
6
|
task default: %i[]
|
|
6
7
|
|
|
7
8
|
# @private
|
|
@@ -15,6 +16,11 @@ def current_version
|
|
|
15
16
|
end
|
|
16
17
|
end
|
|
17
18
|
|
|
19
|
+
desc "Run spec with parallel_rspec"
|
|
20
|
+
task :spec do
|
|
21
|
+
sh "parallel_rspec spec/*.spec.rb spec/**/*.spec.rb"
|
|
22
|
+
end
|
|
23
|
+
|
|
18
24
|
desc "Build emoji_table.rb"
|
|
19
25
|
task :emoji_table do
|
|
20
26
|
require_relative "lib/discorb"
|
|
@@ -65,7 +71,7 @@ namespace :document do
|
|
|
65
71
|
version = current_version
|
|
66
72
|
desc "Just generate document"
|
|
67
73
|
task :yard do
|
|
68
|
-
sh "bundle exec yardoc -o doc/#{version} --locale #{ENV
|
|
74
|
+
sh "bundle exec yardoc -o doc/#{version} --locale #{ENV.fetch("rake_locale", nil) or "en"}"
|
|
69
75
|
end
|
|
70
76
|
|
|
71
77
|
desc "Replace files"
|
|
@@ -76,7 +82,7 @@ namespace :document do
|
|
|
76
82
|
task :css do
|
|
77
83
|
iputs "Replacing css"
|
|
78
84
|
Dir.glob("template-replace/files/**/*.*")
|
|
79
|
-
|
|
85
|
+
.map { |f| f.delete_prefix("template-replace/files") }.each do |file|
|
|
80
86
|
FileUtils.cp("template-replace/files" + file, "doc/#{version}/#{file}")
|
|
81
87
|
end
|
|
82
88
|
sputs "Successfully replaced css"
|
|
@@ -135,9 +141,11 @@ namespace :document do
|
|
|
135
141
|
sputs "Successfully replaced CRLF with LF"
|
|
136
142
|
end
|
|
137
143
|
|
|
144
|
+
desc "change locale of current document"
|
|
138
145
|
task :locale do
|
|
139
146
|
next if ENV["rake_locale"].nil?
|
|
140
|
-
|
|
147
|
+
|
|
148
|
+
require_relative "template-replace/scripts/locale_#{ENV.fetch("rake_locale", nil)}.rb"
|
|
141
149
|
replace_locale("doc/main")
|
|
142
150
|
end
|
|
143
151
|
end
|
|
@@ -196,11 +204,12 @@ namespace :document do
|
|
|
196
204
|
end
|
|
197
205
|
|
|
198
206
|
namespace :locale do
|
|
207
|
+
desc "Generate Japanese document"
|
|
199
208
|
task :ja do
|
|
200
209
|
require "crowdin-api"
|
|
201
210
|
require "zip"
|
|
202
211
|
crowdin = Crowdin::Client.new do |config|
|
|
203
|
-
config.api_token = ENV
|
|
212
|
+
config.api_token = ENV.fetch("CROWDIN_PERSONAL_TOKEN", nil)
|
|
204
213
|
config.project_id = ENV["CROWDIN_PROJECT_ID"].to_i
|
|
205
214
|
end
|
|
206
215
|
build = crowdin.build_project_translation["data"]["id"]
|
|
@@ -216,14 +225,17 @@ namespace :document do
|
|
|
216
225
|
Rake::Task["document:replace"].execute
|
|
217
226
|
end
|
|
218
227
|
|
|
228
|
+
desc "Generate English document"
|
|
219
229
|
task :en do
|
|
220
230
|
Rake::Task["document"].execute("locale:en")
|
|
221
231
|
end
|
|
222
232
|
end
|
|
223
233
|
end
|
|
224
234
|
|
|
235
|
+
desc "Generate rbs file using sord"
|
|
225
236
|
task :rbs do
|
|
226
237
|
require "open3"
|
|
238
|
+
# rubocop: disable Layout/LineLength
|
|
227
239
|
type_errors = {
|
|
228
240
|
"SORD_ERROR_SymbolSymbolSymbolInteger" => "{ r: Integer, g: Integer, b: Integer}",
|
|
229
241
|
"SORD_ERROR_DiscorbRoleDiscorbMemberDiscorbPermissionOverwrite" => "Hash[Discorb::Role | Discorb::Member, Discorb::PermissionOverwrite]",
|
|
@@ -232,9 +244,11 @@ task :rbs do
|
|
|
232
244
|
"SORD_ERROR_dark | SORD_ERROR_light" => '"dark" | "light"',
|
|
233
245
|
"SORD_ERROR_SymbolStringSymbolboolSymbolObject" => "String | Integer | Float",
|
|
234
246
|
}
|
|
247
|
+
# rubocop: enable Layout/LineLength
|
|
235
248
|
regenerate = ARGV.include?("--regenerate") || ARGV.include?("-r")
|
|
236
249
|
|
|
237
|
-
sh "sord gen sig/discorb.rbs --keep-original-comments --no-sord-comments" +
|
|
250
|
+
sh "sord gen sig/discorb.rbs --keep-original-comments --no-sord-comments" +
|
|
251
|
+
(regenerate ? " --regenerate" : " --no-regenerate")
|
|
238
252
|
base = File.read("sig/discorb.rbs")
|
|
239
253
|
base.gsub!(/\n +def _set_data: \(.+\) -> untyped\n\n/, "")
|
|
240
254
|
base.gsub!(/( )?( *)# @private.+?(?:\n\n(?=\1\2#)|(?=\n\2end))/sm, "")
|
|
@@ -242,64 +256,64 @@ task :rbs do
|
|
|
242
256
|
# #region rbs dictionary
|
|
243
257
|
base.gsub!(/ class Dictionary.+?end\n/ms, <<-RBS)
|
|
244
258
|
class Dictionary[K, V]
|
|
245
|
-
|
|
259
|
+
##{" "}
|
|
246
260
|
# Initialize a new Dictionary.
|
|
247
|
-
|
|
261
|
+
##{" "}
|
|
248
262
|
# @param [Hash] hash A hash of items to add to the dictionary.
|
|
249
263
|
# @param [Integer] limit The maximum number of items in the dictionary.
|
|
250
264
|
# @param [false, Proc] sort Whether to sort the items in the dictionary.
|
|
251
265
|
def initialize: (?::Hash[untyped, untyped] hash, ?limit: Integer?, ?sort: (bool | Proc)) -> void
|
|
252
266
|
|
|
253
|
-
|
|
267
|
+
##{" "}
|
|
254
268
|
# Registers a new item in the dictionary.
|
|
255
|
-
|
|
269
|
+
##{" "}
|
|
256
270
|
# @param [#to_s] id The ID of the item.
|
|
257
271
|
# @param [Object] body The item to register.
|
|
258
|
-
|
|
272
|
+
##{" "}
|
|
259
273
|
# @return [self] The dictionary.
|
|
260
274
|
def register: (_ToS id, Object body) -> self
|
|
261
275
|
|
|
262
|
-
|
|
276
|
+
##{" "}
|
|
263
277
|
# Merges another dictionary into this one.
|
|
264
|
-
|
|
278
|
+
##{" "}
|
|
265
279
|
# @param [Discorb::Dictionary] other The dictionary to merge.
|
|
266
280
|
def merge: (Discorb::Dictionary other) -> untyped
|
|
267
281
|
|
|
268
|
-
|
|
282
|
+
##{" "}
|
|
269
283
|
# Removes an item from the dictionary.
|
|
270
|
-
|
|
284
|
+
##{" "}
|
|
271
285
|
# @param [#to_s] id The ID of the item to remove.
|
|
272
286
|
def remove: (_ToS id) -> untyped
|
|
273
287
|
|
|
274
|
-
|
|
288
|
+
##{" "}
|
|
275
289
|
# Get an item from the dictionary.
|
|
276
|
-
|
|
290
|
+
##{" "}
|
|
277
291
|
# @param [#to_s] id The ID of the item.
|
|
278
292
|
# @return [Object] The item.
|
|
279
293
|
# @return [nil] if the item was not found.
|
|
280
|
-
|
|
294
|
+
##{" "}
|
|
281
295
|
# @overload get(index)
|
|
282
296
|
# @param [Integer] index The index of the item.
|
|
283
|
-
|
|
297
|
+
##{" "}
|
|
284
298
|
# @return [Object] The item.
|
|
285
299
|
# @return [nil] if the item is not found.
|
|
286
300
|
def get: (K id) -> V?
|
|
287
301
|
|
|
288
|
-
|
|
302
|
+
##{" "}
|
|
289
303
|
# Returns the values of the dictionary.
|
|
290
|
-
|
|
304
|
+
##{" "}
|
|
291
305
|
# @return [Array] The values of the dictionary.
|
|
292
306
|
def values: () -> ::Array[V]
|
|
293
307
|
|
|
294
|
-
|
|
308
|
+
##{" "}
|
|
295
309
|
# Checks if the dictionary has an ID.
|
|
296
|
-
|
|
310
|
+
##{" "}
|
|
297
311
|
# @param [#to_s] id The ID to check.
|
|
298
|
-
|
|
312
|
+
##{" "}
|
|
299
313
|
# @return [Boolean] `true` if the dictionary has the ID, `false` otherwise.
|
|
300
314
|
def has?: (_ToS id) -> bool
|
|
301
315
|
|
|
302
|
-
|
|
316
|
+
##{" "}
|
|
303
317
|
# Send a message to the array of values.
|
|
304
318
|
def method_missing: (untyped name) -> untyped
|
|
305
319
|
|
|
@@ -315,6 +329,7 @@ task :rbs do
|
|
|
315
329
|
type_errors.each do |error, type|
|
|
316
330
|
base.gsub!(error, type)
|
|
317
331
|
end
|
|
332
|
+
base.gsub!("end\n\n\nend", "end\n")
|
|
318
333
|
File.write("sig/discorb.rbs", base)
|
|
319
334
|
end
|
|
320
335
|
|
|
@@ -322,10 +337,10 @@ task document: %i[document:yard document:replace]
|
|
|
322
337
|
|
|
323
338
|
desc "Lint code with rubocop"
|
|
324
339
|
task :lint do
|
|
325
|
-
sh "rubocop lib"
|
|
340
|
+
sh "rubocop lib spec Rakefile"
|
|
326
341
|
end
|
|
327
342
|
|
|
328
343
|
desc "Autofix code with rubocop"
|
|
329
344
|
task "lint:fix" do
|
|
330
|
-
sh "rubocop lib -A"
|
|
345
|
+
sh "rubocop lib spec Rakefile -A"
|
|
331
346
|
end
|
data/bin/console
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
-
require
|
|
5
|
-
require
|
|
4
|
+
require "bundler/setup"
|
|
5
|
+
require "discorb"
|
|
6
6
|
|
|
7
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
|
@@ -11,5 +11,5 @@ require 'discorb'
|
|
|
11
11
|
# require "pry"
|
|
12
12
|
# Pry.start
|
|
13
13
|
|
|
14
|
-
require
|
|
14
|
+
require "irb"
|
|
15
15
|
IRB.start(__FILE__)
|
data/docs/Examples.md
CHANGED
|
@@ -25,4 +25,4 @@
|
|
|
25
25
|
#### Note
|
|
26
26
|
|
|
27
27
|
This example is not shown correctly in the docs.
|
|
28
|
-
[Read this example on GitHub](https://github.com/discorb-lib/discorb/blob/main/examples/components/select_menu.rb).
|
|
28
|
+
[Read this example on GitHub](https://github.com/discorb-lib/discorb/blob/main/examples/components/select_menu.rb).
|