discorb 0.16.0 → 0.18.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 +2 -4
- data/.github/workflows/spec.yml +33 -0
- data/.github/workflows/validate.yml +21 -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 +30 -1
- data/Gemfile +20 -8
- data/Rakefile +226 -98
- data/Steepfile +28 -0
- 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 +247 -213
- data/docs/extension.md +1 -2
- data/docs/faq.md +0 -1
- data/docs/tutorial.md +18 -18
- data/docs/voice_events.md +106 -106
- data/examples/commands/message.rb +68 -0
- data/examples/commands/permission.rb +19 -0
- data/examples/commands/slash.rb +48 -0
- data/examples/commands/user.rb +54 -0
- data/examples/components/authorization_button.rb +4 -3
- data/examples/components/select_menu.rb +6 -3
- data/examples/extension/main.rb +2 -1
- data/examples/extension/message_expander.rb +6 -2
- data/examples/sig/commands/message.rbs +5 -0
- data/examples/simple/eval.rb +3 -2
- data/examples/simple/ping_pong.rb +2 -1
- data/examples/simple/rolepanel.rb +17 -6
- data/examples/simple/shard.rb +3 -2
- data/examples/simple/wait_for_message.rb +4 -1
- data/exe/discorb +33 -18
- data/lefthook.yml +45 -0
- data/lib/discorb/allowed_mentions.rb +2 -1
- data/lib/discorb/app_command/command.rb +130 -72
- data/lib/discorb/app_command/common.rb +25 -0
- data/lib/discorb/app_command/handler.rb +130 -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 +19 -10
- data/lib/discorb/automod.rb +269 -0
- 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 +246 -0
- data/lib/discorb/channel/stage.rb +140 -0
- data/lib/discorb/channel/text.rb +336 -0
- data/lib/discorb/channel/thread.rb +325 -0
- data/lib/discorb/channel/voice.rb +79 -0
- data/lib/discorb/channel.rb +2 -1165
- data/lib/discorb/client.rb +50 -36
- data/lib/discorb/color.rb +37 -60
- 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/dictionary.rb +1 -1
- data/lib/discorb/embed.rb +26 -10
- data/lib/discorb/emoji.rb +31 -4
- data/lib/discorb/emoji_table.rb +4969 -3
- data/lib/discorb/event.rb +29 -4
- data/lib/discorb/exe/about.rb +2 -1
- data/lib/discorb/exe/irb.rb +2 -4
- data/lib/discorb/exe/new.rb +89 -26
- 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 -7
- data/lib/discorb/flag.rb +13 -2
- data/lib/discorb/gateway.rb +79 -589
- data/lib/discorb/gateway_events.rb +638 -0
- data/lib/discorb/guild.rb +318 -67
- data/lib/discorb/guild_template.rb +11 -5
- data/lib/discorb/http.rb +53 -24
- data/lib/discorb/integration.rb +4 -1
- data/lib/discorb/intents.rb +28 -19
- data/lib/discorb/interaction/autocomplete.rb +28 -16
- data/lib/discorb/interaction/command.rb +42 -14
- data/lib/discorb/interaction/components.rb +5 -2
- data/lib/discorb/interaction/modal.rb +0 -1
- data/lib/discorb/interaction/response.rb +125 -26
- 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 +28 -8
- data/lib/discorb/message.rb +60 -25
- data/lib/discorb/message_meta.rb +3 -3
- data/lib/discorb/modules.rb +59 -16
- data/lib/discorb/presence.rb +2 -0
- data/lib/discorb/rate_limit.rb +7 -2
- data/lib/discorb/reaction.rb +2 -2
- data/lib/discorb/role.rb +20 -5
- data/lib/discorb/shard.rb +1 -1
- data/lib/discorb/sticker.rb +9 -8
- data/lib/discorb/user.rb +4 -3
- data/lib/discorb/utils/colored_puts.rb +1 -0
- data/lib/discorb/voice_state.rb +6 -2
- data/lib/discorb/webhook.rb +64 -31
- data/lib/discorb.rb +7 -5
- data/po/yard.pot +20 -20
- data/rbs_collection.lock.yaml +88 -0
- data/rbs_collection.yaml +21 -0
- data/sig/async.rbs +11 -0
- data/sig/discorb/activity.rbs +23 -0
- data/sig/discorb/allowed_mentions.rbs +44 -0
- data/sig/discorb/app_command/base.rbs +282 -0
- data/sig/discorb/app_command/handler.rbs +171 -0
- data/sig/discorb/application.rbs +142 -0
- data/sig/discorb/asset.rbs +32 -0
- data/sig/discorb/attachment.rbs +91 -0
- data/sig/discorb/audit_log.rbs +231 -0
- data/sig/discorb/automod.rbs +128 -0
- data/sig/discorb/avatar.rbs +26 -0
- data/sig/discorb/channel/base.rbs +179 -0
- data/sig/discorb/channel/category.rbs +56 -0
- data/sig/discorb/channel/container.rbs +29 -0
- data/sig/discorb/channel/dm.rbs +14 -0
- data/sig/discorb/channel/news.rbs +20 -0
- data/sig/discorb/channel/stage.rbs +77 -0
- data/sig/discorb/channel/text.rbs +158 -0
- data/sig/discorb/channel/thread.rbs +185 -0
- data/sig/discorb/channel/voice.rbs +41 -0
- data/sig/discorb/client.rbs +2495 -0
- data/sig/discorb/color.rbs +142 -0
- data/sig/discorb/component/base.rbs +28 -0
- data/sig/discorb/component/button.rbs +65 -0
- data/sig/discorb/component/select_menu.rbs +107 -0
- data/sig/discorb/component/text_input.rbs +69 -0
- data/sig/discorb/connectable.rbs +8 -0
- data/sig/discorb/custom_emoji.rbs +90 -0
- data/sig/discorb/dictionary.rbs +85 -0
- data/sig/discorb/discord_model.rbs +15 -0
- data/sig/discorb/embed.rbs +279 -0
- data/sig/discorb/emoji.rbs +13 -0
- data/sig/discorb/error.rbs +73 -0
- data/sig/discorb/event_handler.rbs +27 -0
- data/sig/discorb/extension.rbs +1734 -0
- data/sig/discorb/flag.rbs +72 -0
- data/sig/discorb/gateway.rbs +481 -0
- data/sig/discorb/guild.rbs +870 -0
- data/sig/discorb/guild_template.rbs +174 -0
- data/sig/discorb/http.rbs +147 -0
- data/sig/discorb/image.rbs +20 -0
- data/sig/discorb/integration.rbs +118 -0
- data/sig/discorb/intents.rbs +97 -0
- data/sig/discorb/interaction/autocomplete.rbs +9 -0
- data/sig/discorb/interaction/base.rbs +66 -0
- data/sig/discorb/interaction/command.rbs +66 -0
- data/sig/discorb/interaction/message_component.rbs +140 -0
- data/sig/discorb/interaction/modal.rbs +50 -0
- data/sig/discorb/interaction/responder.rbs +157 -0
- data/sig/discorb/invite.rbs +86 -0
- data/sig/discorb/member.rbs +187 -0
- data/sig/discorb/message.rbs +469 -0
- data/sig/discorb/messageable.rbs +153 -0
- data/sig/discorb/partial_emoji.rbs +35 -0
- data/sig/discorb/permissions.rbs +149 -0
- data/sig/discorb/presence.rbs +237 -0
- data/sig/discorb/reaction.rbs +33 -0
- data/sig/discorb/role.rbs +145 -0
- data/sig/discorb/scheduled_event.rbs +148 -0
- data/sig/discorb/shard.rbs +62 -0
- data/sig/discorb/snowflake.rbs +56 -0
- data/sig/discorb/stage_instance.rbs +63 -0
- data/sig/discorb/sticker.rbs +116 -0
- data/sig/discorb/system_channel_flag.rbs +17 -0
- data/sig/discorb/unicode_emoji.rbs +49 -0
- data/sig/discorb/user.rbs +93 -0
- data/sig/discorb/utils.rbs +8 -0
- data/sig/discorb/voice_region.rbs +30 -0
- data/sig/discorb/voice_state.rbs +71 -0
- data/sig/discorb/webhook.rbs +327 -0
- data/sig/discorb/welcome_screen.rbs +78 -0
- data/sig/discorb.rbs +6 -7230
- data/sig/manifest.yaml +3 -0
- data/sig/override.rbs +19 -0
- data/template-replace/files/css/common.css +4 -0
- metadata +102 -6
- data/examples/commands/bookmarker.rb +0 -42
- data/examples/commands/hello.rb +0 -10
- data/examples/commands/inspect.rb +0 -25
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,88 @@
|
|
|
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: net-http
|
|
10
|
+
version: '0'
|
|
11
|
+
source:
|
|
12
|
+
type: stdlib
|
|
13
|
+
- name: logger
|
|
14
|
+
version: '0'
|
|
15
|
+
source:
|
|
16
|
+
type: stdlib
|
|
17
|
+
- name: ast
|
|
18
|
+
version: '2.4'
|
|
19
|
+
source:
|
|
20
|
+
type: git
|
|
21
|
+
name: ruby/gem_rbs_collection
|
|
22
|
+
revision: 347858a6750d478f6cf1285b4ebd6ae945af2609
|
|
23
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
24
|
+
repo_dir: gems
|
|
25
|
+
- name: forwardable
|
|
26
|
+
version: '0'
|
|
27
|
+
source:
|
|
28
|
+
type: stdlib
|
|
29
|
+
- name: i18n
|
|
30
|
+
version: '1.10'
|
|
31
|
+
source:
|
|
32
|
+
type: git
|
|
33
|
+
name: ruby/gem_rbs_collection
|
|
34
|
+
revision: 347858a6750d478f6cf1285b4ebd6ae945af2609
|
|
35
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
36
|
+
repo_dir: gems
|
|
37
|
+
- name: listen
|
|
38
|
+
version: '3.2'
|
|
39
|
+
source:
|
|
40
|
+
type: git
|
|
41
|
+
name: ruby/gem_rbs_collection
|
|
42
|
+
revision: 347858a6750d478f6cf1285b4ebd6ae945af2609
|
|
43
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
44
|
+
repo_dir: gems
|
|
45
|
+
- name: minitest
|
|
46
|
+
version: '0'
|
|
47
|
+
source:
|
|
48
|
+
type: stdlib
|
|
49
|
+
- name: parallel
|
|
50
|
+
version: '1.20'
|
|
51
|
+
source:
|
|
52
|
+
type: git
|
|
53
|
+
name: ruby/gem_rbs_collection
|
|
54
|
+
revision: 347858a6750d478f6cf1285b4ebd6ae945af2609
|
|
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: 347858a6750d478f6cf1285b4ebd6ae945af2609
|
|
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: uri
|
|
74
|
+
version: '0'
|
|
75
|
+
source:
|
|
76
|
+
type: stdlib
|
|
77
|
+
- name: timeout
|
|
78
|
+
version: '0'
|
|
79
|
+
source:
|
|
80
|
+
type: stdlib
|
|
81
|
+
- name: monitor
|
|
82
|
+
version: '0'
|
|
83
|
+
source:
|
|
84
|
+
type: stdlib
|
|
85
|
+
- name: mutex_m
|
|
86
|
+
version: '0'
|
|
87
|
+
source:
|
|
88
|
+
type: stdlib
|
data/rbs_collection.yaml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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
|
|
18
|
+
- name: net-http
|
|
19
|
+
- name: logger
|
|
20
|
+
- name: activesupport
|
|
21
|
+
ignore: true
|
data/sig/async.rbs
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Discorb
|
|
2
|
+
#
|
|
3
|
+
# Represents an activity for Gateway Command.
|
|
4
|
+
class Activity
|
|
5
|
+
TYPES: untyped
|
|
6
|
+
|
|
7
|
+
#
|
|
8
|
+
# Initializes a new Activity.
|
|
9
|
+
#
|
|
10
|
+
# @param [String] name The name of the activity.
|
|
11
|
+
# @param [:playing, :streaming, :listening, :watching, :competing] type The type of activity.
|
|
12
|
+
# @param [String] url The URL of the activity.
|
|
13
|
+
def initialize: (String name, ?Symbol `type`, ?String? url) -> void
|
|
14
|
+
|
|
15
|
+
#
|
|
16
|
+
# Converts the activity to a hash.
|
|
17
|
+
#
|
|
18
|
+
# @return [Hash] A hash representation of the activity.
|
|
19
|
+
def to_hash: -> Discorb::json
|
|
20
|
+
|
|
21
|
+
def inspect: -> String
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module Discorb
|
|
2
|
+
#
|
|
3
|
+
# Represents a allowed mentions in a message.
|
|
4
|
+
class AllowedMentions
|
|
5
|
+
#
|
|
6
|
+
# Initializes a new instance of the AllowedMentions class.
|
|
7
|
+
#
|
|
8
|
+
# @param [Boolean] everyone Whether to allow @everyone or @here.
|
|
9
|
+
# @param [Boolean, Array<Discorb::Role>] roles The roles to allow, or false to disable.
|
|
10
|
+
# @param [Boolean, Array<Discorb::User>] users The users to allow, or false to disable.
|
|
11
|
+
# @param [Boolean] replied_user Whether to ping the user that sent the message to reply.
|
|
12
|
+
def initialize: (
|
|
13
|
+
?everyone: bool?,
|
|
14
|
+
?roles: (bool | ::Array[Discorb::Role])?,
|
|
15
|
+
?users: (bool | ::Array[Discorb::User])?,
|
|
16
|
+
?replied_user: bool?
|
|
17
|
+
) -> void
|
|
18
|
+
|
|
19
|
+
def inspect: -> String
|
|
20
|
+
|
|
21
|
+
#
|
|
22
|
+
# Converts the object to a hash.
|
|
23
|
+
# @private
|
|
24
|
+
#
|
|
25
|
+
# @param [Discorb::AllowedMentions, nil] other The object to merge.
|
|
26
|
+
#
|
|
27
|
+
# @return [Hash] The hash.
|
|
28
|
+
def to_hash: (?Discorb::AllowedMentions? other) -> ::Hash[untyped, untyped]
|
|
29
|
+
|
|
30
|
+
def nil_merge: (*untyped args) -> untyped
|
|
31
|
+
|
|
32
|
+
# @return [Boolean] Whether to allow @everyone or @here.
|
|
33
|
+
attr_accessor everyone: bool?
|
|
34
|
+
|
|
35
|
+
# @return [Boolean, Array<Discorb::Role>] The roles to allow, or false to disable.
|
|
36
|
+
attr_accessor roles: (bool | ::Array[Discorb::Role])?
|
|
37
|
+
|
|
38
|
+
# @return [Boolean, Array<Discorb::User>] The users to allow, or false to disable.
|
|
39
|
+
attr_accessor users: (bool | ::Array[Discorb::User])?
|
|
40
|
+
|
|
41
|
+
# @return [Boolean] Whether to ping the user that sent the message to reply.
|
|
42
|
+
attr_accessor replied_user: bool?
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
module Discorb
|
|
2
|
+
#
|
|
3
|
+
# Handles application commands.
|
|
4
|
+
module ApplicationCommand
|
|
5
|
+
VALID_LOCALES: untyped
|
|
6
|
+
type option =
|
|
7
|
+
{
|
|
8
|
+
name_localizations: Hash[(Symbol | String), String]?,
|
|
9
|
+
description: localizable?,
|
|
10
|
+
required: bool?,
|
|
11
|
+
optional: bool?,
|
|
12
|
+
default: untyped?,
|
|
13
|
+
type: (singleton(String)
|
|
14
|
+
| :string
|
|
15
|
+
| :str
|
|
16
|
+
| singleton(Integer)
|
|
17
|
+
| :integer
|
|
18
|
+
| :int
|
|
19
|
+
| singleton(TrueClass)
|
|
20
|
+
| singleton(FalseClass)
|
|
21
|
+
| :boolean
|
|
22
|
+
| :bool
|
|
23
|
+
| singleton(Discorb::User)
|
|
24
|
+
| singleton(Discorb::Member)
|
|
25
|
+
| :user
|
|
26
|
+
| :member
|
|
27
|
+
| singleton(Discorb::Channel)
|
|
28
|
+
| :channel
|
|
29
|
+
| singleton(Discorb::Role)
|
|
30
|
+
| :role
|
|
31
|
+
| :mentionable
|
|
32
|
+
| singleton(Float)
|
|
33
|
+
| :float
|
|
34
|
+
| :attachment)?,
|
|
35
|
+
choices: Hash[String, (String | Integer | Float)]?,
|
|
36
|
+
choices_localizations: Hash[String, Hash[(Symbol | String), String]]?,
|
|
37
|
+
channel_types: Array[Class]?,
|
|
38
|
+
autocomplete: ^(Discorb::CommandInteraction) -> Hash[String, String]?,
|
|
39
|
+
range: Range[(Integer | Float)]?
|
|
40
|
+
}
|
|
41
|
+
type options = ::Hash[String, option]
|
|
42
|
+
type localizable = String | Hash[Symbol | String, String]
|
|
43
|
+
type guild_ids = Array[_ToS] | false | nil
|
|
44
|
+
|
|
45
|
+
def self?.modify_localization_hash: (
|
|
46
|
+
Hash[Symbol | String, String] hash
|
|
47
|
+
) -> Hash[String, String]
|
|
48
|
+
|
|
49
|
+
#
|
|
50
|
+
# Represents a application command.
|
|
51
|
+
# @abstract
|
|
52
|
+
class Command < Discorb::DiscordModel
|
|
53
|
+
TYPES: Hash[Integer, Symbol]
|
|
54
|
+
|
|
55
|
+
#
|
|
56
|
+
# Initialize a new command.
|
|
57
|
+
# @private
|
|
58
|
+
#
|
|
59
|
+
# @param [String, Hash{Symbol => String}] name The name of the command.
|
|
60
|
+
# @param [Array<#to_s>, false, nil] guild_ids The guild ids that the command is enabled in.
|
|
61
|
+
# @param [Proc] block The block of the command.
|
|
62
|
+
# @param [Integer] type The type of the command.
|
|
63
|
+
# @param [Boolean] dm_permission Whether the command is enabled in DMs.
|
|
64
|
+
# @param [Discorb::Permission] default_permission The default permission of the command.
|
|
65
|
+
def initialize: (
|
|
66
|
+
Discorb::ApplicationCommand::localizable name,
|
|
67
|
+
Discorb::ApplicationCommand::guild_ids guild_ids,
|
|
68
|
+
^(Discorb::Interaction, *untyped) -> untyped block,
|
|
69
|
+
Integer `type`,
|
|
70
|
+
?bool? dm_permission,
|
|
71
|
+
?Discorb::Permission? default_permission
|
|
72
|
+
) -> void
|
|
73
|
+
|
|
74
|
+
#
|
|
75
|
+
# Changes the self pointer of block to the given object.
|
|
76
|
+
# @private
|
|
77
|
+
#
|
|
78
|
+
# @param [Object] instance The object to change the self pointer to.
|
|
79
|
+
def replace_block: (Object `instance`) -> untyped
|
|
80
|
+
|
|
81
|
+
#
|
|
82
|
+
# Converts the object to a hash.
|
|
83
|
+
# @private
|
|
84
|
+
#
|
|
85
|
+
# @return [Hash] The hash represents the object.
|
|
86
|
+
def to_hash: -> Discorb::json
|
|
87
|
+
|
|
88
|
+
# @return [Hash{String => String}] The name of the command.
|
|
89
|
+
attr_reader name: ::Hash[String, String]
|
|
90
|
+
|
|
91
|
+
# @return [Array<#to_s>] The guild ids that the command is enabled in.
|
|
92
|
+
attr_reader guild_ids: Discorb::ApplicationCommand::guild_ids
|
|
93
|
+
|
|
94
|
+
# @return [Proc] The block of the command.
|
|
95
|
+
attr_reader block: ^(Discorb::Interaction, *untyped) -> untyped
|
|
96
|
+
|
|
97
|
+
# @return [:chat_input, :user, :message] The type of the command.
|
|
98
|
+
attr_reader type: Symbol
|
|
99
|
+
|
|
100
|
+
# @return [Integer] The raw type of the command.
|
|
101
|
+
attr_reader type_raw: Integer
|
|
102
|
+
|
|
103
|
+
# @return [Discorb::Permission] The default permissions for this command.
|
|
104
|
+
attr_reader default_permission: Discorb::Permission?
|
|
105
|
+
|
|
106
|
+
# @return [Boolean] Whether the command is enabled in DMs.
|
|
107
|
+
attr_reader dm_permission: bool?
|
|
108
|
+
|
|
109
|
+
#
|
|
110
|
+
# Represents the slash command.
|
|
111
|
+
class ChatInputCommand < Discorb::ApplicationCommand::Command
|
|
112
|
+
#
|
|
113
|
+
# Initialize a new slash command.
|
|
114
|
+
# @private
|
|
115
|
+
#
|
|
116
|
+
# @param [String, Hash{Symbol => String}] name The name of the command.
|
|
117
|
+
# The hash should have `default`, and language keys.
|
|
118
|
+
# @param [String, Hash{Symbol => String}] description The description of the command.
|
|
119
|
+
# The hash should have `default`, and language keys.
|
|
120
|
+
# @param [Hash{String => Hash}] options The options of the command.
|
|
121
|
+
# @param [Array<#to_s>] guild_ids The guild ids that the command is enabled in.
|
|
122
|
+
# @param [Proc] block The block of the command.
|
|
123
|
+
# @param [Integer] type The type of the command.
|
|
124
|
+
# @param [Discorb::ApplicationCommand::Command, nil] parent The parent command.
|
|
125
|
+
# @param [Boolean] dm_permission Whether the command is enabled in DMs.
|
|
126
|
+
# @param [Discorb::Permission] default_permission The default permission of the command.
|
|
127
|
+
def initialize: (
|
|
128
|
+
Discorb::ApplicationCommand::localizable name,
|
|
129
|
+
Discorb::ApplicationCommand::localizable description,
|
|
130
|
+
Discorb::ApplicationCommand::options options,
|
|
131
|
+
Discorb::ApplicationCommand::guild_ids guild_ids,
|
|
132
|
+
^(
|
|
133
|
+
Discorb::CommandInteraction::ChatInputCommand,
|
|
134
|
+
*untyped
|
|
135
|
+
) -> untyped block,
|
|
136
|
+
Integer `type`,
|
|
137
|
+
Discorb::ApplicationCommand::Command? parent,
|
|
138
|
+
bool? dm_permission,
|
|
139
|
+
Discorb::Permission? default_permission
|
|
140
|
+
) -> void
|
|
141
|
+
|
|
142
|
+
#
|
|
143
|
+
# Returns the commands name.
|
|
144
|
+
#
|
|
145
|
+
# @return [String] The name of the command.
|
|
146
|
+
def to_s: -> String
|
|
147
|
+
|
|
148
|
+
#
|
|
149
|
+
# Converts the object to a hash.
|
|
150
|
+
# @private
|
|
151
|
+
#
|
|
152
|
+
# @return [Hash] The hash represents the object.
|
|
153
|
+
def to_hash: -> Discorb::json
|
|
154
|
+
|
|
155
|
+
# @return [Hash{String => String}] The description of the command.
|
|
156
|
+
attr_reader description: ::Hash[String, String]
|
|
157
|
+
|
|
158
|
+
# @return [Hash{String => Hash}] The options of the command.
|
|
159
|
+
attr_reader options: ::Hash[String, ::Hash[untyped, untyped]]
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
#
|
|
163
|
+
# Represents the command with subcommands.
|
|
164
|
+
class GroupCommand < Discorb::ApplicationCommand::Command
|
|
165
|
+
#
|
|
166
|
+
# Initialize a new group command.
|
|
167
|
+
# @private
|
|
168
|
+
#
|
|
169
|
+
# @param [String, Hash{Symbol => String}] name The name of the command.
|
|
170
|
+
# @param [String, Hash{Symbol => String}] description The description of the command.
|
|
171
|
+
# @param [Array<#to_s>] guild_ids The guild ids that the command is enabled in.
|
|
172
|
+
# @param [Discorb::Client] client The client of the command.
|
|
173
|
+
# @param [Boolean] dm_permission Whether the command is enabled in DMs.
|
|
174
|
+
# @param [Discorb::Permission] default_permission The default permission of the command.
|
|
175
|
+
def initialize: (
|
|
176
|
+
Discorb::ApplicationCommand::localizable name,
|
|
177
|
+
Discorb::ApplicationCommand::localizable description,
|
|
178
|
+
Discorb::ApplicationCommand::guild_ids guild_ids,
|
|
179
|
+
Discorb::Client client,
|
|
180
|
+
bool? dm_permission,
|
|
181
|
+
Discorb::Permission? default_permission
|
|
182
|
+
) -> void
|
|
183
|
+
|
|
184
|
+
#
|
|
185
|
+
# Add new subcommand.
|
|
186
|
+
#
|
|
187
|
+
# @param (see Discorb::ApplicationCommand::Handler#slash)
|
|
188
|
+
# @return [Discorb::ApplicationCommand::Command::ChatInputCommand] The added subcommand.
|
|
189
|
+
def slash: (
|
|
190
|
+
String | ::Hash[Symbol, String] command_name,
|
|
191
|
+
String | ::Hash[Symbol, String] description,
|
|
192
|
+
?Discorb::ApplicationCommand::options options,
|
|
193
|
+
?dm_permission: bool,
|
|
194
|
+
?default_permission: Discorb::Permission?
|
|
195
|
+
) {
|
|
196
|
+
(Discorb::CommandInteraction::ChatInputCommand, *untyped) -> void
|
|
197
|
+
} -> Discorb::ApplicationCommand::Command::ChatInputCommand
|
|
198
|
+
|
|
199
|
+
#
|
|
200
|
+
# Add new subcommand group.
|
|
201
|
+
#
|
|
202
|
+
# @param [String] command_name Group name.
|
|
203
|
+
# @param [String] description Group description.
|
|
204
|
+
#
|
|
205
|
+
# @yield Block to yield with the command.
|
|
206
|
+
# @yieldparam [Discorb::ApplicationCommand::Command::SubcommandGroup] group Group command.
|
|
207
|
+
#
|
|
208
|
+
# @return [Discorb::ApplicationCommand::Command::SubcommandGroup] Command object.
|
|
209
|
+
#
|
|
210
|
+
# @see file:docs/application_command.md Application Commands
|
|
211
|
+
def group: (
|
|
212
|
+
String command_name,
|
|
213
|
+
String description
|
|
214
|
+
) ?{
|
|
215
|
+
(Discorb::ApplicationCommand::Command::SubcommandGroup group) -> void
|
|
216
|
+
} -> Discorb::ApplicationCommand::Command::SubcommandGroup
|
|
217
|
+
|
|
218
|
+
#
|
|
219
|
+
# Returns the command name.
|
|
220
|
+
#
|
|
221
|
+
# @return [String] The command name.
|
|
222
|
+
def to_s: -> String
|
|
223
|
+
|
|
224
|
+
#
|
|
225
|
+
# Changes the self pointer to the given object.
|
|
226
|
+
# @private
|
|
227
|
+
#
|
|
228
|
+
# @param [Object] instance The object to change to.
|
|
229
|
+
def block_replace: (Object `instance`) -> untyped
|
|
230
|
+
|
|
231
|
+
#
|
|
232
|
+
# Converts the object to a hash.
|
|
233
|
+
# @private
|
|
234
|
+
#
|
|
235
|
+
# @return [Hash] The hash represents the object.
|
|
236
|
+
def to_hash: -> Discorb::json
|
|
237
|
+
|
|
238
|
+
# @return [Array<Discorb::ApplicationCommand::Command>] The subcommands of the command.
|
|
239
|
+
attr_reader commands: ::Array[Discorb::ApplicationCommand::Command]
|
|
240
|
+
|
|
241
|
+
# @return [String] The description of the command.
|
|
242
|
+
attr_reader description: ::Hash[String, String]
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
#
|
|
246
|
+
# Represents the subcommand group.
|
|
247
|
+
class SubcommandGroup < Discorb::ApplicationCommand::Command::GroupCommand
|
|
248
|
+
#
|
|
249
|
+
# Initialize a new subcommand group.
|
|
250
|
+
# @private
|
|
251
|
+
#
|
|
252
|
+
# @param [String] name The name of the command.
|
|
253
|
+
# @param [String] description The description of the command.
|
|
254
|
+
# @param [Discorb::ApplicationCommand::Command::GroupCommand] parent The parent command.
|
|
255
|
+
# @param [Discorb::Client] client The client.
|
|
256
|
+
def initialize: (
|
|
257
|
+
String name,
|
|
258
|
+
String description,
|
|
259
|
+
Discorb::ApplicationCommand::Command::GroupCommand parent,
|
|
260
|
+
Discorb::Client client
|
|
261
|
+
) -> void
|
|
262
|
+
|
|
263
|
+
def to_s: -> untyped
|
|
264
|
+
|
|
265
|
+
#
|
|
266
|
+
# Add new subcommand.
|
|
267
|
+
# @param (see Discorb::ApplicationCommand::Handler#slash)
|
|
268
|
+
# @return [Discorb::ApplicationCommand::Command::ChatInputCommand] The added subcommand.
|
|
269
|
+
def slash: (
|
|
270
|
+
Discorb::ApplicationCommand::localizable command_name,
|
|
271
|
+
Discorb::ApplicationCommand::localizable description,
|
|
272
|
+
?Discorb::ApplicationCommand::options options
|
|
273
|
+
) {
|
|
274
|
+
(Discorb::CommandInteraction::ChatInputCommand, *untyped) -> void
|
|
275
|
+
} -> Discorb::ApplicationCommand::Command::ChatInputCommand
|
|
276
|
+
|
|
277
|
+
# @return [Array<Discorb::ApplicationCommand::Command::ChatInputCommand>] The subcommands of the command.
|
|
278
|
+
attr_reader commands: ::Array[Discorb::ApplicationCommand::Command]
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
end
|