discorb 0.15.1 → 0.17.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +1 -0
  3. data/.github/workflows/build_main.yml +2 -2
  4. data/.github/workflows/build_version.yml +1 -1
  5. data/.github/workflows/codeql-analysis.yml +1 -1
  6. data/.github/workflows/lint-push.yml +3 -5
  7. data/.github/workflows/lint.yml +1 -1
  8. data/.github/workflows/spec.yml +33 -0
  9. data/.gitignore +2 -0
  10. data/.lefthook/commit-msg/validator.rb +5 -0
  11. data/.rspec +2 -0
  12. data/.rspec_parallel +2 -0
  13. data/.rubocop.yml +43 -6
  14. data/Changelog.md +29 -1
  15. data/Gemfile +14 -8
  16. data/Rakefile +44 -28
  17. data/bin/console +3 -3
  18. data/docs/Examples.md +1 -1
  19. data/docs/application_command.md +156 -47
  20. data/docs/cli/irb.md +2 -2
  21. data/docs/cli/new.md +14 -9
  22. data/docs/cli/run.md +7 -11
  23. data/docs/cli.md +17 -10
  24. data/docs/events.md +224 -210
  25. data/docs/extension.md +1 -2
  26. data/docs/faq.md +0 -1
  27. data/docs/tutorial.md +12 -12
  28. data/docs/voice_events.md +106 -106
  29. data/examples/commands/message.rb +63 -0
  30. data/examples/commands/permission.rb +18 -0
  31. data/examples/commands/slash.rb +44 -0
  32. data/examples/commands/user.rb +51 -0
  33. data/examples/components/authorization_button.rb +2 -2
  34. data/examples/components/select_menu.rb +2 -2
  35. data/examples/extension/main.rb +1 -1
  36. data/examples/extension/message_expander.rb +5 -2
  37. data/examples/simple/eval.rb +2 -2
  38. data/examples/simple/ping_pong.rb +1 -1
  39. data/examples/simple/rolepanel.rb +2 -2
  40. data/examples/simple/shard.rb +17 -0
  41. data/examples/simple/wait_for_message.rb +1 -1
  42. data/exe/discorb +31 -16
  43. data/lefthook.yml +45 -0
  44. data/lib/discorb/allowed_mentions.rb +1 -0
  45. data/lib/discorb/app_command/command.rb +124 -65
  46. data/lib/discorb/app_command/common.rb +25 -0
  47. data/lib/discorb/app_command/handler.rb +117 -34
  48. data/lib/discorb/app_command.rb +2 -1
  49. data/lib/discorb/application.rb +1 -0
  50. data/lib/discorb/asset.rb +1 -2
  51. data/lib/discorb/attachment.rb +1 -1
  52. data/lib/discorb/audit_logs.rb +14 -9
  53. data/lib/discorb/channel/base.rb +108 -0
  54. data/lib/discorb/channel/category.rb +32 -0
  55. data/lib/discorb/channel/container.rb +44 -0
  56. data/lib/discorb/channel/dm.rb +28 -0
  57. data/lib/discorb/channel/guild.rb +245 -0
  58. data/lib/discorb/channel/stage.rb +140 -0
  59. data/lib/discorb/channel/text.rb +345 -0
  60. data/lib/discorb/channel/thread.rb +321 -0
  61. data/lib/discorb/channel/voice.rb +79 -0
  62. data/lib/discorb/channel.rb +2 -1165
  63. data/lib/discorb/client.rb +158 -66
  64. data/lib/discorb/common.rb +2 -1
  65. data/lib/discorb/components/button.rb +2 -1
  66. data/lib/discorb/components/select_menu.rb +4 -2
  67. data/lib/discorb/components/text_input.rb +12 -2
  68. data/lib/discorb/components.rb +1 -1
  69. data/lib/discorb/embed.rb +22 -7
  70. data/lib/discorb/emoji.rb +30 -3
  71. data/lib/discorb/emoji_table.rb +4969 -3
  72. data/lib/discorb/event.rb +29 -4
  73. data/lib/discorb/exe/about.rb +1 -0
  74. data/lib/discorb/exe/irb.rb +2 -4
  75. data/lib/discorb/exe/new.rb +95 -28
  76. data/lib/discorb/exe/run.rb +9 -37
  77. data/lib/discorb/exe/setup.rb +25 -12
  78. data/lib/discorb/exe/show.rb +4 -3
  79. data/lib/discorb/extend.rb +1 -0
  80. data/lib/discorb/extension.rb +6 -3
  81. data/lib/discorb/flag.rb +11 -0
  82. data/lib/discorb/gateway.rb +237 -148
  83. data/lib/discorb/guild.rb +188 -56
  84. data/lib/discorb/guild_template.rb +10 -4
  85. data/lib/discorb/http.rb +17 -10
  86. data/lib/discorb/integration.rb +4 -1
  87. data/lib/discorb/intents.rb +1 -1
  88. data/lib/discorb/interaction/autocomplete.rb +29 -17
  89. data/lib/discorb/interaction/command.rb +38 -14
  90. data/lib/discorb/interaction/components.rb +6 -3
  91. data/lib/discorb/interaction/modal.rb +0 -1
  92. data/lib/discorb/interaction/response.rb +63 -24
  93. data/lib/discorb/interaction/root.rb +14 -14
  94. data/lib/discorb/interaction.rb +1 -0
  95. data/lib/discorb/invite.rb +5 -2
  96. data/lib/discorb/member.rb +25 -5
  97. data/lib/discorb/message.rb +47 -14
  98. data/lib/discorb/message_meta.rb +1 -0
  99. data/lib/discorb/modules.rb +56 -14
  100. data/lib/discorb/presence.rb +2 -2
  101. data/lib/discorb/rate_limit.rb +8 -3
  102. data/lib/discorb/role.rb +19 -4
  103. data/lib/discorb/shard.rb +74 -0
  104. data/lib/discorb/sticker.rb +8 -7
  105. data/lib/discorb/user.rb +2 -1
  106. data/lib/discorb/utils/colored_puts.rb +1 -0
  107. data/lib/discorb/voice_state.rb +10 -6
  108. data/lib/discorb/webhook.rb +51 -27
  109. data/lib/discorb.rb +7 -5
  110. data/po/yard.pot +20 -20
  111. data/rbs_collection.lock.yaml +96 -0
  112. data/rbs_collection.yaml +17 -0
  113. data/sig/async.rbs +5 -0
  114. data/sig/discorb.rbs +8667 -6851
  115. data/template-replace/files/css/common.css +4 -0
  116. metadata +26 -6
  117. data/examples/commands/bookmarker.rb +0 -42
  118. data/examples/commands/hello.rb +0 -10
  119. data/examples/commands/inspect.rb +0 -25
  120. data/lib/discorb/log.rb +0 -81
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4bc9c7d6433e9e093a0d58d821ed97e3f001d63224c9f65eb1693a2ee3d16f7d
4
- data.tar.gz: daff87553c1996cbc1a68765ee3df54947f46b7660fc1a16f0a17a0e0660e2c7
3
+ metadata.gz: c4cee4be461c639c494c2981f65ba496a17e4336fcb440218c2a4852d375b277
4
+ data.tar.gz: 4e743b61201c82a387f580cc75e0fa448dd357c5b02af5339df9b950898c0c38
5
5
  SHA512:
6
- metadata.gz: dceaba51436368feeb9e99bc4afda5cea9ac45aa0525bb44cdd33c427fef6c6617d17bf1a56b27acac137df05b4d6f27395e22883ce574e4e48d3e7a8ca05a13
7
- data.tar.gz: 81622ca789eee2f8c55b4fd98e7c0bdc602d164247602508c8b041757d61fcb77f659d01142db8a8c16b9dd6e6cc402ebf9f45cf881e787a77449ba4831b8376
6
+ metadata.gz: b440b0e1f9e19161b666df325e01120905c3cf7f38e45cb4c89db4c9c7273b9626a5bed8825706317a84605417ac8b0f688450378622ee188cd3307d1905e7c0
7
+ data.tar.gz: b6bfc1d6c2e64918d0b0a73529029c01b50b33ac399a83bf18e30ef5bc6e7eb1c458f1aec7ce607349c36c2ba1585ded988c33d0607ece6048f0da9571af334d
data/.gitattributes CHANGED
@@ -1,2 +1,3 @@
1
1
  template-replace/**/* linguist-documentation
2
2
  sig/* linguist-generated
3
+ lib/discorb/emoji_table.rb linguist-generated
@@ -3,7 +3,7 @@ name: Build YARD with main
3
3
  on:
4
4
  workflow_dispatch:
5
5
  schedule:
6
- - cron: "*/8 * * * *"
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@v2
14
+ - uses: actions/checkout@v3
15
15
  with:
16
16
  fetch-depth: 0
17
17
  - name: Set up Ruby
@@ -11,7 +11,7 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
 
13
13
  steps:
14
- - uses: actions/checkout@v2
14
+ - uses: actions/checkout@v3
15
15
  with:
16
16
  fetch-depth: 0
17
17
  - name: Set up Ruby
@@ -38,7 +38,7 @@ jobs:
38
38
 
39
39
  steps:
40
40
  - name: Checkout repository
41
- uses: actions/checkout@v2
41
+ uses: actions/checkout@v3
42
42
 
43
43
  # Initializes the CodeQL tools for scanning.
44
44
  - name: Initialize CodeQL
@@ -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@v2
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
- gem install rubocop
15
+ bundle install
18
16
  - name: Run rubocop
19
17
  run: |
20
- rubocop lib
18
+ rake lint
@@ -6,7 +6,7 @@ jobs:
6
6
  runs-on: ubuntu-latest
7
7
  steps:
8
8
  - name: Checkout repository
9
- uses: actions/checkout@v2
9
+ uses: actions/checkout@v3
10
10
  - uses: ruby/setup-ruby@v1
11
11
  with:
12
12
  ruby-version: 3.0.0
@@ -0,0 +1,33 @@
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
+ os:
17
+ - "ubuntu-latest"
18
+ - "windows-latest"
19
+ runs-on: ${{ matrix.os }}
20
+ steps:
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby-version }}
25
+ bundler-cache: true
26
+ - name: Checkout repository
27
+ uses: actions/checkout@v3
28
+ - name: Install dependencies
29
+ run: |
30
+ bundle install
31
+ gem update uri
32
+ - name: Run spec
33
+ run: bundle exec rake spec
data/.gitignore CHANGED
@@ -61,3 +61,5 @@ tmp-doc
61
61
  doc
62
62
  *.zip
63
63
  **/*.po
64
+
65
+ .gem_rbs_collection
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ message = File.read(ARGV[0])
4
+ raise "Commit message is empty" if message.empty?
5
+ raise "Commit message must be ASCII" unless message.ascii_only?
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ -P spec/**/*.rb
2
+ -p
data/.rspec_parallel ADDED
@@ -0,0 +1,2 @@
1
+ spec/*.spec.rb
2
+ spec/**/*.spec.rb
data/.rubocop.yml CHANGED
@@ -2,13 +2,38 @@ AllCops:
2
2
  NewCops: enable
3
3
  TargetRubyVersion: 3.0
4
4
  Exclude:
5
- - examples/**/*.rb
5
+ - lib/discorb/emoji_table.rb
6
6
 
7
- Layout:
8
- Enabled: false
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,35 @@
4
4
 
5
5
  # Changelog
6
6
 
7
+ ## v0.17
8
+
9
+ ### v0.17.1
10
+
11
+ - Add: Add valid rbs file.
12
+ - Change: Message content intent warning will show only once.
13
+ - Update: Update audit log events.
14
+
15
+ ### v0.17.0
16
+
17
+ - Change!: Delete `Interaction#target` and `Interaction#fired_by`.
18
+ - Change: `Interaction#user` and `Interaction#member` are same.
19
+ - Add: Include Messageable in VoiceChannel
20
+ - Add: Add `--[no-]bundler` option to `discorb` command.
21
+ - Add: Add `--[no-]comment` option to `discorb new` command.
22
+ - Fix PermissionOverwrite was initialized with string.
23
+ - Fix emoji with different skin tones raises ArgumentError.
24
+ - Fix `Asset#endpoint` raises NameError.
25
+ - Fix `:error` event may call itself.
26
+
27
+ ## v0.16
28
+
29
+ ### v0.16.0
30
+
31
+ - Change!: Use built-in Logger instead of custom Logger.
32
+ - Delete!: `--log-level`, `--[no-]log-color` is deleted.
33
+ - Add: Support sharding
34
+ - Add: Use Mutex for preventing connection duplications.
35
+
7
36
  ## v0.15
8
37
 
9
38
  ### v0.15.1
@@ -447,4 +476,3 @@ end
447
476
  ### v0.0.1
448
477
 
449
478
  - Initial release
450
-
data/Gemfile CHANGED
@@ -7,10 +7,20 @@ gemspec
7
7
 
8
8
  gem "rake", "~> 13.0"
9
9
 
10
- group :development, optional: true do
11
- gem "rufo", "~> 0.13.0"
12
- gem "sord", "~> 3.0.1"
13
- end
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["rake_locale"] or "en"}"
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
- .map { |f| f.delete_prefix("template-replace/files") }.each do |file|
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
- require_relative "template-replace/scripts/locale_#{ENV["rake_locale"]}.rb"
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["CROWDIN_PERSONAL_TOKEN"]
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,74 +244,76 @@ 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" + (regenerate ? " --regenerate" : " --no-regenerate")
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
- base.gsub!(/\n +def _set_data: \(.+\) -> untyped\n\n/, "")
240
- base.gsub!(/( )?( *)# @private.+?(?:\n\n(?=\1\2#)|(?=\n\2end))/sm, "")
253
+ base.gsub!(/\n +def _set_data: \(.+\) -> untyped\n\n/, "\n")
254
+ # base.gsub!(/( )?( *)# @private.+?(?:\n\n(?=\1\2#)|(?=\n\2end))/sm, "")
241
255
  base.gsub!(/untyped ([a-z_]*id)/, "_ToS \\1")
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,8 @@ 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")
333
+ base.gsub!(/ +$/m, "")
318
334
  File.write("sig/discorb.rbs", base)
319
335
  end
320
336
 
@@ -322,10 +338,10 @@ task document: %i[document:yard document:replace]
322
338
 
323
339
  desc "Lint code with rubocop"
324
340
  task :lint do
325
- sh "rubocop lib"
341
+ sh "rubocop lib spec Rakefile"
326
342
  end
327
343
 
328
344
  desc "Autofix code with rubocop"
329
345
  task "lint:fix" do
330
- sh "rubocop lib -A"
346
+ sh "rubocop lib spec Rakefile -A"
331
347
  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 'bundler/setup'
5
- require 'discorb'
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 'irb'
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).