discorb 0.15.1 → 0.17.1
Sign up to get free protection for your applications and to get access to all the features.
- 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 +33 -0
- data/.gitignore +2 -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 +29 -1
- data/Gemfile +14 -8
- data/Rakefile +44 -28
- data/bin/console +3 -3
- data/docs/Examples.md +1 -1
- data/docs/application_command.md +156 -47
- 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 +224 -210
- 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 +2 -2
- data/examples/simple/shard.rb +17 -0
- 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 +124 -65
- data/lib/discorb/app_command/common.rb +25 -0
- data/lib/discorb/app_command/handler.rb +117 -34
- 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 +14 -9
- 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 +158 -66
- 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 +95 -28
- data/lib/discorb/exe/run.rb +9 -37
- 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 +237 -148
- data/lib/discorb/guild.rb +188 -56
- data/lib/discorb/guild_template.rb +10 -4
- data/lib/discorb/http.rb +17 -10
- data/lib/discorb/integration.rb +4 -1
- data/lib/discorb/intents.rb +1 -1
- data/lib/discorb/interaction/autocomplete.rb +29 -17
- data/lib/discorb/interaction/command.rb +38 -14
- data/lib/discorb/interaction/components.rb +6 -3
- data/lib/discorb/interaction/modal.rb +0 -1
- data/lib/discorb/interaction/response.rb +63 -24
- data/lib/discorb/interaction/root.rb +14 -14
- 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 +8 -3
- data/lib/discorb/role.rb +19 -4
- data/lib/discorb/shard.rb +74 -0
- 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 +51 -27
- data/lib/discorb.rb +7 -5
- data/po/yard.pot +20 -20
- data/rbs_collection.lock.yaml +96 -0
- data/rbs_collection.yaml +17 -0
- data/sig/async.rbs +5 -0
- data/sig/discorb.rbs +8667 -6851
- data/template-replace/files/css/common.css +4 -0
- metadata +26 -6
- data/examples/commands/bookmarker.rb +0 -42
- data/examples/commands/hello.rb +0 -10
- data/examples/commands/inspect.rb +0 -25
- data/lib/discorb/log.rb +0 -81
data/lib/discorb.rb
CHANGED
@@ -9,7 +9,8 @@ module Discorb
|
|
9
9
|
# @private
|
10
10
|
#
|
11
11
|
# @!macro [new] async
|
12
|
-
# @note This is an asynchronous method, it will return a `Async::Task` object.
|
12
|
+
# @note This is an asynchronous method, it will return a `Async::Task` object.
|
13
|
+
# Use `Async::Task#wait` to get the result.
|
13
14
|
#
|
14
15
|
# @!macro [new] client_cache
|
15
16
|
# @note This method returns an object from client cache. it will return `nil` if the object is not in cache.
|
@@ -19,7 +20,8 @@ module Discorb
|
|
19
20
|
# @note You must enable `GUILD_MEMBERS` intent to use this method.
|
20
21
|
#
|
21
22
|
# @!macro edit
|
22
|
-
# @note The arguments of this method are defaultly set to `Discorb::Unset`.
|
23
|
+
# @note The arguments of this method are defaultly set to `Discorb::Unset`.
|
24
|
+
# Specify value to set the value, if not don't specify or specify `Discorb::Unset`.
|
23
25
|
#
|
24
26
|
# @!macro http
|
25
27
|
# @note This method calls HTTP request.
|
@@ -42,13 +44,13 @@ module Discorb
|
|
42
44
|
end
|
43
45
|
|
44
46
|
require_order = %w[common flag dictionary error rate_limit http intents emoji_table modules] +
|
45
|
-
%w[message_meta allowed_mentions] +
|
47
|
+
%w[channel/container message_meta allowed_mentions] +
|
46
48
|
%w[user member guild emoji channel embed message] +
|
47
49
|
%w[application audit_logs color components event event_handler] +
|
48
|
-
%w[attachment guild_template image integration interaction invite
|
50
|
+
%w[attachment guild_template image integration interaction invite permission] +
|
49
51
|
%w[presence reaction role sticker utils voice_state webhook] +
|
50
52
|
%w[gateway_requests gateway app_command] +
|
51
|
-
%w[asset extension client extend]
|
53
|
+
%w[asset extension shard client extend]
|
52
54
|
require_order.each do |name|
|
53
55
|
require_relative "discorb/#{name}.rb"
|
54
56
|
end
|
data/po/yard.pot
CHANGED
@@ -2907,23 +2907,23 @@ msgid "### How can I send files?"
|
|
2907
2907
|
msgstr ""
|
2908
2908
|
|
2909
2909
|
#: ../docs/faq.md:65
|
2910
|
-
msgid "Use {Discorb::
|
2910
|
+
msgid "Use {Discorb::Attachment} class."
|
2911
2911
|
msgstr ""
|
2912
2912
|
|
2913
2913
|
#: ../docs/faq.md:67
|
2914
2914
|
msgid "```ruby\n"
|
2915
2915
|
"# Send a file\n"
|
2916
|
-
"message.channel.post file: Discorb::
|
2916
|
+
"message.channel.post file: Discorb::Attachment.new(File.open(\"./README.md\"))"
|
2917
2917
|
msgstr ""
|
2918
2918
|
|
2919
2919
|
#: ../docs/faq.md:71
|
2920
2920
|
msgid "# Send some files with text\n"
|
2921
|
-
"message.channel.post \"File!\", files: [Discorb::
|
2921
|
+
"message.channel.post \"File!\", files: [Discorb::Attachment.new(File.open(\"./README.md\")), Discorb::Attachment.new(File.open(\"./License.txt\"))]"
|
2922
2922
|
msgstr ""
|
2923
2923
|
|
2924
2924
|
#: ../docs/faq.md:74
|
2925
2925
|
msgid "# Send a string as a file\n"
|
2926
|
-
"message.channel.post file: Discorb::
|
2926
|
+
"message.channel.post file: Discorb::Attachment.from_string(\"Hello world!\", \"hello.txt\")\n"
|
2927
2927
|
"```"
|
2928
2928
|
msgstr ""
|
2929
2929
|
|
@@ -4519,7 +4519,7 @@ msgid "Command block."
|
|
4519
4519
|
msgstr ""
|
4520
4520
|
|
4521
4521
|
# @return [Discorb::ApplicationCommand::Command::GroupCommand]
|
4522
|
-
# @return [Discorb::ApplicationCommand::Command::
|
4522
|
+
# @return [Discorb::ApplicationCommand::Command::ChatInputCommand]
|
4523
4523
|
# @return [Discorb::ApplicationCommand::Command::SubcommandGroup]
|
4524
4524
|
# @return [Discorb::ApplicationCommand::Command]
|
4525
4525
|
#: ../lib/discorb/app_command.rb:40
|
@@ -4722,7 +4722,7 @@ msgstr ""
|
|
4722
4722
|
msgid "a new instance of Command"
|
4723
4723
|
msgstr ""
|
4724
4724
|
|
4725
|
-
# Discorb::ApplicationCommand::Command::
|
4725
|
+
# Discorb::ApplicationCommand::Command::ChatInputCommand
|
4726
4726
|
#: ../lib/discorb/app_command.rb:194
|
4727
4727
|
msgid "Represents the slash command."
|
4728
4728
|
msgstr ""
|
@@ -4738,12 +4738,12 @@ msgstr ""
|
|
4738
4738
|
msgid "The options of the command."
|
4739
4739
|
msgstr ""
|
4740
4740
|
|
4741
|
-
# @return [
|
4741
|
+
# @return [ChatInputCommand]
|
4742
4742
|
#: ../lib/discorb/app_command.rb:203
|
4743
|
-
msgid "a new instance of
|
4743
|
+
msgid "a new instance of ChatInputCommand"
|
4744
4744
|
msgstr ""
|
4745
4745
|
|
4746
|
-
# Discorb::ApplicationCommand::Command::
|
4746
|
+
# Discorb::ApplicationCommand::Command::ChatInputCommand#to_s
|
4747
4747
|
#: ../lib/discorb/app_command.rb:213
|
4748
4748
|
msgid "Returns the commands name."
|
4749
4749
|
msgstr ""
|
@@ -4753,8 +4753,8 @@ msgstr ""
|
|
4753
4753
|
msgid "Represents the command with subcommands."
|
4754
4754
|
msgstr ""
|
4755
4755
|
|
4756
|
-
# @return [Array<Discorb::ApplicationCommand::Command::
|
4757
|
-
# @return [Array<Discorb::ApplicationCommand::Command::
|
4756
|
+
# @return [Array<Discorb::ApplicationCommand::Command::ChatInputCommand, Discorb::ApplicationCommand::Command::SubcommandGroup>]
|
4757
|
+
# @return [Array<Discorb::ApplicationCommand::Command::ChatInputCommand>]
|
4758
4758
|
#: ../lib/discorb/app_command.rb:275
|
4759
4759
|
#: ../lib/discorb/app_command.rb:372
|
4760
4760
|
msgid "The subcommands of the command."
|
@@ -4772,7 +4772,7 @@ msgstr ""
|
|
4772
4772
|
msgid "Add new subcommand."
|
4773
4773
|
msgstr ""
|
4774
4774
|
|
4775
|
-
# @return [Discorb::ApplicationCommand::Command::
|
4775
|
+
# @return [Discorb::ApplicationCommand::Command::ChatInputCommand]
|
4776
4776
|
#: ../lib/discorb/app_command.rb:294
|
4777
4777
|
#: ../lib/discorb/app_command.rb:391
|
4778
4778
|
msgid "The added subcommand."
|
@@ -9511,7 +9511,7 @@ msgstr ""
|
|
9511
9511
|
msgid "a new instance of Attachment"
|
9512
9512
|
msgstr ""
|
9513
9513
|
|
9514
|
-
# Discorb::
|
9514
|
+
# Discorb::Attachment
|
9515
9515
|
#: ../lib/discorb/file.rb:53
|
9516
9516
|
msgid "Represents a file to send as an attachment."
|
9517
9517
|
msgstr ""
|
@@ -9537,7 +9537,7 @@ msgstr ""
|
|
9537
9537
|
msgid "The content type of the file. If not set, it is guessed from the filename."
|
9538
9538
|
msgstr ""
|
9539
9539
|
|
9540
|
-
# Discorb::
|
9540
|
+
# Discorb::Attachment#initialize
|
9541
9541
|
#: ../lib/discorb/file.rb:64
|
9542
9542
|
msgid "Creates a new file from IO."
|
9543
9543
|
msgstr ""
|
@@ -9570,7 +9570,7 @@ msgstr ""
|
|
9570
9570
|
msgid "tag|param|content_type"
|
9571
9571
|
msgstr ""
|
9572
9572
|
|
9573
|
-
# Discorb::
|
9573
|
+
# Discorb::Attachment.from_string
|
9574
9574
|
#: ../lib/discorb/file.rb:79
|
9575
9575
|
msgid "Creates a new file from a string."
|
9576
9576
|
msgstr ""
|
@@ -11738,7 +11738,7 @@ msgstr ""
|
|
11738
11738
|
msgid "A helper method to send multipart/form-data requests for creating messages."
|
11739
11739
|
msgstr ""
|
11740
11740
|
|
11741
|
-
# @param [Array<Discorb::
|
11741
|
+
# @param [Array<Discorb::Attachment>]
|
11742
11742
|
#: ../lib/discorb/http.rb:154
|
11743
11743
|
#: ../lib/discorb/interaction/response.rb:91
|
11744
11744
|
#: ../lib/discorb/interaction/response.rb:115
|
@@ -11750,7 +11750,7 @@ msgstr ""
|
|
11750
11750
|
msgid "tag|param|files"
|
11751
11751
|
msgstr ""
|
11752
11752
|
|
11753
|
-
# @param [Array<Discorb::
|
11753
|
+
# @param [Array<Discorb::Attachment>] files
|
11754
11754
|
#: ../lib/discorb/http.rb:154
|
11755
11755
|
#: ../lib/discorb/interaction/response.rb:91
|
11756
11756
|
#: ../lib/discorb/interaction/response.rb:115
|
@@ -12122,7 +12122,7 @@ msgstr ""
|
|
12122
12122
|
msgid "Represents a command interaction."
|
12123
12123
|
msgstr ""
|
12124
12124
|
|
12125
|
-
# Discorb::CommandInteraction::
|
12125
|
+
# Discorb::CommandInteraction::ChatInputCommand
|
12126
12126
|
#: ../lib/discorb/interaction/command.rb:11
|
12127
12127
|
msgid "Represents a slash command interaction."
|
12128
12128
|
msgstr ""
|
@@ -12357,7 +12357,7 @@ msgstr ""
|
|
12357
12357
|
msgid "tag|param|attachments"
|
12358
12358
|
msgstr ""
|
12359
12359
|
|
12360
|
-
# @param [Discorb::
|
12360
|
+
# @param [Discorb::Attachment]
|
12361
12361
|
#: ../lib/discorb/interaction/response.rb:91
|
12362
12362
|
#: ../lib/discorb/interaction/response.rb:115
|
12363
12363
|
#: ../lib/discorb/modules.rb:25
|
@@ -12375,7 +12375,7 @@ msgstr ""
|
|
12375
12375
|
msgid "The new embeds of the message."
|
12376
12376
|
msgstr ""
|
12377
12377
|
|
12378
|
-
# @param [Discorb::
|
12378
|
+
# @param [Discorb::Attachment] file
|
12379
12379
|
#: ../lib/discorb/interaction/response.rb:91
|
12380
12380
|
#: ../lib/discorb/interaction/response.rb:115
|
12381
12381
|
#: ../lib/discorb/modules.rb:25
|
@@ -0,0 +1,96 @@
|
|
1
|
+
---
|
2
|
+
sources:
|
3
|
+
- name: ruby/gem_rbs_collection
|
4
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
5
|
+
revision: main
|
6
|
+
repo_dir: gems
|
7
|
+
path: ".gem_rbs_collection"
|
8
|
+
gems:
|
9
|
+
- name: activesupport
|
10
|
+
version: '6.0'
|
11
|
+
source:
|
12
|
+
type: git
|
13
|
+
name: ruby/gem_rbs_collection
|
14
|
+
revision: 8e1f19e0c8768b6bac2815fe65a3310298ba400e
|
15
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
16
|
+
repo_dir: gems
|
17
|
+
- name: ast
|
18
|
+
version: '2.4'
|
19
|
+
source:
|
20
|
+
type: git
|
21
|
+
name: ruby/gem_rbs_collection
|
22
|
+
revision: 8e1f19e0c8768b6bac2815fe65a3310298ba400e
|
23
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
24
|
+
repo_dir: gems
|
25
|
+
- name: date
|
26
|
+
version: '0'
|
27
|
+
source:
|
28
|
+
type: stdlib
|
29
|
+
- name: forwardable
|
30
|
+
version: '0'
|
31
|
+
source:
|
32
|
+
type: stdlib
|
33
|
+
- name: i18n
|
34
|
+
version: '1.10'
|
35
|
+
source:
|
36
|
+
type: git
|
37
|
+
name: ruby/gem_rbs_collection
|
38
|
+
revision: 8e1f19e0c8768b6bac2815fe65a3310298ba400e
|
39
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
40
|
+
repo_dir: gems
|
41
|
+
- name: listen
|
42
|
+
version: '3.2'
|
43
|
+
source:
|
44
|
+
type: git
|
45
|
+
name: ruby/gem_rbs_collection
|
46
|
+
revision: 8e1f19e0c8768b6bac2815fe65a3310298ba400e
|
47
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
48
|
+
repo_dir: gems
|
49
|
+
- name: parallel
|
50
|
+
version: '1.20'
|
51
|
+
source:
|
52
|
+
type: git
|
53
|
+
name: ruby/gem_rbs_collection
|
54
|
+
revision: 8e1f19e0c8768b6bac2815fe65a3310298ba400e
|
55
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
56
|
+
repo_dir: gems
|
57
|
+
- name: prime
|
58
|
+
version: '0'
|
59
|
+
source:
|
60
|
+
type: stdlib
|
61
|
+
- name: rainbow
|
62
|
+
version: '3.0'
|
63
|
+
source:
|
64
|
+
type: git
|
65
|
+
name: ruby/gem_rbs_collection
|
66
|
+
revision: 8e1f19e0c8768b6bac2815fe65a3310298ba400e
|
67
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
68
|
+
repo_dir: gems
|
69
|
+
- name: singleton
|
70
|
+
version: '0'
|
71
|
+
source:
|
72
|
+
type: stdlib
|
73
|
+
- name: time
|
74
|
+
version: '0'
|
75
|
+
source:
|
76
|
+
type: stdlib
|
77
|
+
- name: uri
|
78
|
+
version: '0'
|
79
|
+
source:
|
80
|
+
type: stdlib
|
81
|
+
- name: monitor
|
82
|
+
version: '0'
|
83
|
+
source:
|
84
|
+
type: stdlib
|
85
|
+
- name: logger
|
86
|
+
version: '0'
|
87
|
+
source:
|
88
|
+
type: stdlib
|
89
|
+
- name: mutex_m
|
90
|
+
version: '0'
|
91
|
+
source:
|
92
|
+
type: stdlib
|
93
|
+
- name: pathname
|
94
|
+
version: '0'
|
95
|
+
source:
|
96
|
+
type: stdlib
|
data/rbs_collection.yaml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Download sources
|
2
|
+
sources:
|
3
|
+
- name: ruby/gem_rbs_collection
|
4
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
5
|
+
revision: main
|
6
|
+
repo_dir: gems
|
7
|
+
|
8
|
+
# A directory to install the downloaded RBSs
|
9
|
+
path: .gem_rbs_collection
|
10
|
+
|
11
|
+
gems:
|
12
|
+
# Skip loading rbs gem's RBS.
|
13
|
+
# It's unnecessary if you don't use rbs as a library.
|
14
|
+
- name: rbs
|
15
|
+
ignore: true
|
16
|
+
- name: discorb
|
17
|
+
ignore: true
|