discorb 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/sig/discorb.rbs CHANGED
@@ -1247,7 +1247,7 @@ module Discorb
1247
1247
  # This class shouldn't be instantiated directly.
1248
1248
  # Use {Client#on} instead.
1249
1249
  class Event
1250
- def initialize: (untyped block, untyped id, untyped discriminator) -> void
1250
+ def initialize: (untyped block, untyped id, untyped metadata) -> void
1251
1251
 
1252
1252
  # Calls the block associated with the event.
1253
1253
  def call: () -> untyped
@@ -1258,8 +1258,8 @@ module Discorb
1258
1258
  # _@return_ — the event id.
1259
1259
  attr_reader id: Symbol
1260
1260
 
1261
- # _@return_ — the event discriminator.
1262
- attr_reader discriminator: ::Hash[untyped, untyped]
1261
+ # _@return_ — the event metadata.
1262
+ attr_reader metadata: ::Hash[untyped, untyped]
1263
1263
 
1264
1264
  # _@return_ — whether the event is once or not.
1265
1265
  attr_reader once: bool
@@ -2143,7 +2143,7 @@ module Discorb
2143
2143
  # Class for connecting to the Discord server.
2144
2144
  class Client
2145
2145
  include Discorb::Gateway::Handler
2146
- include Discorb::Command::Handler
2146
+ include Discorb::ApplicationCommand::Handler
2147
2147
 
2148
2148
  # Initializes a new client.
2149
2149
  #
@@ -2176,19 +2176,19 @@ module Discorb
2176
2176
  #
2177
2177
  # _@param_ `id` — Custom ID of the event.
2178
2178
  #
2179
- # _@param_ `discriminator` — The discriminator of the event.
2179
+ # _@param_ `metadata` — The metadata of the event.
2180
2180
  #
2181
2181
  # _@param_ `block` — The block to execute when the event is triggered.
2182
2182
  #
2183
2183
  # _@return_ — The event.
2184
2184
  #
2185
2185
  # _@see_ `file:docs/Events.md`
2186
- def on: (Symbol event_name, ?id: Symbol?, **::Hash[untyped, untyped] discriminator) -> Discorb::Event
2186
+ def on: (Symbol event_name, ?id: Symbol?, **::Hash[untyped, untyped] metadata) -> Discorb::Event
2187
2187
 
2188
2188
  # Almost same as {#on}, but only triggers the event once.
2189
2189
  #
2190
2190
  # _@return_ — The event.
2191
- def once: (Symbol event_name, ?id: Symbol?, **::Hash[untyped, untyped] discriminator) -> Discorb::Event
2191
+ def once: (Symbol event_name, ?id: Symbol?, **::Hash[untyped, untyped] metadata) -> Discorb::Event
2192
2192
 
2193
2193
  # Remove event by ID.
2194
2194
  #
@@ -2334,7 +2334,7 @@ module Discorb
2334
2334
  String description,
2335
2335
  ?::Hash[String, Hash[:description | :optional | :type, Object]] options,
2336
2336
  ?guild_ids: (::Array[untyped] | bool)?
2337
- ) -> Discorb::Command::Command::SlashCommand
2337
+ ) -> Discorb::ApplicationCommand::Command::SlashCommand
2338
2338
 
2339
2339
  # Add new command with group.
2340
2340
  #
@@ -2349,7 +2349,7 @@ module Discorb
2349
2349
  # _@see_ `file:docs/slash_command.md`
2350
2350
  #
2351
2351
  # _@see_ `file:docs/cli/setup.md`
2352
- def slash_group: (String command_name, String description, ?guild_ids: (::Array[untyped] | bool)?) -> Discorb::Command::Command::GroupCommand
2352
+ def slash_group: (String command_name, String description, ?guild_ids: (::Array[untyped] | bool)?) -> Discorb::ApplicationCommand::Command::GroupCommand
2353
2353
 
2354
2354
  # Add message context menu command.
2355
2355
  #
@@ -2360,7 +2360,7 @@ module Discorb
2360
2360
  # _@param_ `block` — Command block.
2361
2361
  #
2362
2362
  # _@return_ — Command object.
2363
- def message_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::CommandInteraction::UserMenuCommand interaction, Discorb::Message message) -> void } -> Discorb::Command::Command
2363
+ def message_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::ApplicationCommandInteraction::UserMenuCommand interaction, Discorb::Message message) -> void } -> Discorb::ApplicationCommand::Command
2364
2364
 
2365
2365
  # Add user context menu command.
2366
2366
  #
@@ -2371,7 +2371,7 @@ module Discorb
2371
2371
  # _@param_ `block` — Command block.
2372
2372
  #
2373
2373
  # _@return_ — Command object.
2374
- def user_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::CommandInteraction::UserMenuCommand interaction, Discorb::User user) -> void } -> Discorb::Command::Command
2374
+ def user_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::ApplicationCommandInteraction::UserMenuCommand interaction, Discorb::User user) -> void } -> Discorb::ApplicationCommand::Command
2375
2375
 
2376
2376
  # Setup commands.
2377
2377
  #
@@ -2441,7 +2441,7 @@ module Discorb
2441
2441
  attr_reader log: Discorb::Logger
2442
2442
 
2443
2443
  # _@return_ — The commands that the client is using.
2444
- attr_reader commands: ::Array[Discorb::Command::Command]
2444
+ attr_reader commands: ::Array[Discorb::ApplicationCommand::Command]
2445
2445
 
2446
2446
  # _@return_ — The ping of the client.
2447
2447
  # @note This will be calculated from heartbeat and heartbeat_ack.
@@ -4002,7 +4002,7 @@ module Discorb
4002
4002
  String description,
4003
4003
  ?::Hash[String, Hash[:description | :optional | :type, Object]] options,
4004
4004
  ?guild_ids: (::Array[untyped] | bool)?
4005
- ) -> Discorb::Command::Command::SlashCommand
4005
+ ) -> Discorb::ApplicationCommand::Command::SlashCommand
4006
4006
 
4007
4007
  # Add new command with group.
4008
4008
  #
@@ -4017,7 +4017,7 @@ module Discorb
4017
4017
  # _@see_ `file:docs/slash_command.md`
4018
4018
  #
4019
4019
  # _@see_ `file:docs/cli/setup.md`
4020
- def slash_group: (String command_name, String description, ?guild_ids: (::Array[untyped] | bool)?) -> Discorb::Command::Command::GroupCommand
4020
+ def slash_group: (String command_name, String description, ?guild_ids: (::Array[untyped] | bool)?) -> Discorb::ApplicationCommand::Command::GroupCommand
4021
4021
 
4022
4022
  # Add message context menu command.
4023
4023
  #
@@ -4028,7 +4028,7 @@ module Discorb
4028
4028
  # _@param_ `block` — Command block.
4029
4029
  #
4030
4030
  # _@return_ — Command object.
4031
- def message_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::CommandInteraction::UserMenuCommand interaction, Discorb::Message message) -> void } -> Discorb::Command::Command
4031
+ def message_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::ApplicationCommandInteraction::UserMenuCommand interaction, Discorb::Message message) -> void } -> Discorb::ApplicationCommand::Command
4032
4032
 
4033
4033
  # Add user context menu command.
4034
4034
  #
@@ -4039,7 +4039,7 @@ module Discorb
4039
4039
  # _@param_ `block` — Command block.
4040
4040
  #
4041
4041
  # _@return_ — Command object.
4042
- def user_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::CommandInteraction::UserMenuCommand interaction, Discorb::User user) -> void } -> Discorb::Command::Command
4042
+ def user_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::ApplicationCommandInteraction::UserMenuCommand interaction, Discorb::User user) -> void } -> Discorb::ApplicationCommand::Command
4043
4043
 
4044
4044
  # Setup commands.
4045
4045
  #
@@ -4086,7 +4086,7 @@ module Discorb
4086
4086
 
4087
4087
  #
4088
4088
  # Represents the slash command.
4089
- class SlashCommand < Discorb::Command::Command
4089
+ class SlashCommand < Discorb::ApplicationCommand::Command
4090
4090
  def initialize: (
4091
4091
  untyped name,
4092
4092
  untyped description,
@@ -4113,7 +4113,7 @@ module Discorb
4113
4113
 
4114
4114
  #
4115
4115
  # Represents the command with subcommands.
4116
- class GroupCommand < Discorb::Command::Command
4116
+ class GroupCommand < Discorb::ApplicationCommand::Command
4117
4117
  def initialize: (
4118
4118
  untyped name,
4119
4119
  untyped description,
@@ -4125,7 +4125,7 @@ module Discorb
4125
4125
  # Add new subcommand.
4126
4126
  #
4127
4127
  # _@return_ — The added subcommand.
4128
- def slash: (String command_name, String description, ?::Hash[String, Hash[:description | :optional | :type, Object]] options) -> Discorb::Command::Command::SlashCommand
4128
+ def slash: (String command_name, String description, ?::Hash[String, Hash[:description | :optional | :type, Object]] options) -> Discorb::ApplicationCommand::Command::SlashCommand
4129
4129
 
4130
4130
  # Add new subcommand group.
4131
4131
  #
@@ -4136,7 +4136,7 @@ module Discorb
4136
4136
  # _@return_ — Command object.
4137
4137
  #
4138
4138
  # _@see_ `file:docs/slash_command.md`
4139
- def group: (String command_name, String description) -> Discorb::Command::Command::SubcommandGroup
4139
+ def group: (String command_name, String description) -> Discorb::ApplicationCommand::Command::SubcommandGroup
4140
4140
 
4141
4141
  # Returns the command name.
4142
4142
  #
@@ -4146,7 +4146,7 @@ module Discorb
4146
4146
  def to_hash: () -> untyped
4147
4147
 
4148
4148
  # _@return_ — The subcommands of the command.
4149
- attr_reader commands: ::Array[(Discorb::Command::Command::SlashCommand | Discorb::Command::Command::SubcommandGroup)]
4149
+ attr_reader commands: ::Array[(Discorb::ApplicationCommand::Command::SlashCommand | Discorb::ApplicationCommand::Command::SubcommandGroup)]
4150
4150
 
4151
4151
  # _@return_ — The description of the command.
4152
4152
  attr_reader description: String
@@ -4154,7 +4154,7 @@ module Discorb
4154
4154
 
4155
4155
  #
4156
4156
  # Represents the subcommand group.
4157
- class SubcommandGroup < Discorb::Command::Command::GroupCommand
4157
+ class SubcommandGroup < Discorb::ApplicationCommand::Command::GroupCommand
4158
4158
  def initialize: (
4159
4159
  untyped name,
4160
4160
  untyped description,
@@ -4167,10 +4167,10 @@ module Discorb
4167
4167
  # Add new subcommand.
4168
4168
  #
4169
4169
  # _@return_ — The added subcommand.
4170
- def slash: (String command_name, String description, ?::Hash[String, Hash[:description | :optional | :type, Object]] options) -> Discorb::Command::Command::SlashCommand
4170
+ def slash: (String command_name, String description, ?::Hash[String, Hash[:description | :optional | :type, Object]] options) -> Discorb::ApplicationCommand::Command::SlashCommand
4171
4171
 
4172
4172
  # _@return_ — The subcommands of the command.
4173
- attr_reader commands: ::Array[Discorb::Command::Command::SlashCommand]
4173
+ attr_reader commands: ::Array[Discorb::ApplicationCommand::Command::SlashCommand]
4174
4174
  end
4175
4175
  end
4176
4176
  end
@@ -5785,7 +5785,7 @@ module Discorb
5785
5785
  # @see file:docs/extension.md
5786
5786
  # @abstract
5787
5787
  module Extension
5788
- include Discorb::Command::Handler
5788
+ include Discorb::ApplicationCommand::Handler
5789
5789
 
5790
5790
  # Define a new event.
5791
5791
  #
@@ -5793,12 +5793,12 @@ module Discorb
5793
5793
  #
5794
5794
  # _@param_ `id` — The id of the event. Used to delete the event.
5795
5795
  #
5796
- # _@param_ `discriminator` — Other discriminators.
5796
+ # _@param_ `metadata` — Other metadata.
5797
5797
  #
5798
5798
  # _@param_ `block` — The block to execute when the event is triggered.
5799
5799
  #
5800
5800
  # _@return_ — The event.
5801
- def event: (Symbol event_name, ?id: Symbol?, **::Hash[untyped, untyped] discriminator) -> Discorb::Event
5801
+ def event: (Symbol event_name, ?id: Symbol?, **::Hash[untyped, untyped] metadata) -> Discorb::Event
5802
5802
 
5803
5803
  # Define a new once event.
5804
5804
  #
@@ -5806,12 +5806,12 @@ module Discorb
5806
5806
  #
5807
5807
  # _@param_ `id` — The id of the event. Used to delete the event.
5808
5808
  #
5809
- # _@param_ `discriminator` — Other discriminators.
5809
+ # _@param_ `metadata` — Other metadata.
5810
5810
  #
5811
5811
  # _@param_ `block` — The block to execute when the event is triggered.
5812
5812
  #
5813
5813
  # _@return_ — The event.
5814
- def once_event: (Symbol event_name, ?id: Symbol?, **::Hash[untyped, untyped] discriminator) -> Discorb::Event
5814
+ def once_event: (Symbol event_name, ?id: Symbol?, **::Hash[untyped, untyped] metadata) -> Discorb::Event
5815
5815
 
5816
5816
  def self.extended: (untyped obj) -> untyped
5817
5817
 
@@ -5835,7 +5835,7 @@ module Discorb
5835
5835
  String description,
5836
5836
  ?::Hash[String, Hash[:description | :optional | :type, Object]] options,
5837
5837
  ?guild_ids: (::Array[untyped] | bool)?
5838
- ) -> Discorb::Command::Command::SlashCommand
5838
+ ) -> Discorb::ApplicationCommand::Command::SlashCommand
5839
5839
 
5840
5840
  # Add new command with group.
5841
5841
  #
@@ -5850,7 +5850,7 @@ module Discorb
5850
5850
  # _@see_ `file:docs/slash_command.md`
5851
5851
  #
5852
5852
  # _@see_ `file:docs/cli/setup.md`
5853
- def slash_group: (String command_name, String description, ?guild_ids: (::Array[untyped] | bool)?) -> Discorb::Command::Command::GroupCommand
5853
+ def slash_group: (String command_name, String description, ?guild_ids: (::Array[untyped] | bool)?) -> Discorb::ApplicationCommand::Command::GroupCommand
5854
5854
 
5855
5855
  # Add message context menu command.
5856
5856
  #
@@ -5861,7 +5861,7 @@ module Discorb
5861
5861
  # _@param_ `block` — Command block.
5862
5862
  #
5863
5863
  # _@return_ — Command object.
5864
- def message_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::CommandInteraction::UserMenuCommand interaction, Discorb::Message message) -> void } -> Discorb::Command::Command
5864
+ def message_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::ApplicationCommandInteraction::UserMenuCommand interaction, Discorb::Message message) -> void } -> Discorb::ApplicationCommand::Command
5865
5865
 
5866
5866
  # Add user context menu command.
5867
5867
  #
@@ -5872,7 +5872,7 @@ module Discorb
5872
5872
  # _@param_ `block` — Command block.
5873
5873
  #
5874
5874
  # _@return_ — Command object.
5875
- def user_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::CommandInteraction::UserMenuCommand interaction, Discorb::User user) -> void } -> Discorb::Command::Command
5875
+ def user_command: (String command_name, ?guild_ids: (::Array[untyped] | bool)?) ?{ (Discorb::ApplicationCommandInteraction::UserMenuCommand interaction, Discorb::User user) -> void } -> Discorb::ApplicationCommand::Command
5876
5876
 
5877
5877
  # Setup commands.
5878
5878
  #
@@ -5889,7 +5889,7 @@ module Discorb
5889
5889
  attr_reader events: ::Hash[Symbol, ::Array[Discorb::Event]]
5890
5890
 
5891
5891
  # _@return_ — The commands of the extension.
5892
- attr_reader commands: ::Array[Discorb::Command::Command]
5892
+ attr_reader commands: ::Array[Discorb::ApplicationCommand::Command]
5893
5893
 
5894
5894
  attr_reader bottom_commands: untyped
5895
5895
 
@@ -6252,7 +6252,7 @@ module Discorb
6252
6252
  end
6253
6253
  end
6254
6254
 
6255
- class Dictionary
6255
+ class Dictionary[K, V]
6256
6256
  # Initialize a new Dictionary.
6257
6257
  #
6258
6258
  # _@param_ `hash` — A hash of items to add to the dictionary.
@@ -6288,12 +6288,12 @@ module Discorb
6288
6288
  # _@return_ — The item.
6289
6289
  #
6290
6290
  # _@return_ — if the item was not found.
6291
- def get: (untyped id) -> Object
6291
+ def get: (untyped id) -> V
6292
6292
 
6293
6293
  # Returns the values of the dictionary.
6294
6294
  #
6295
6295
  # _@return_ — The values of the dictionary.
6296
- def values: () -> ::Array[untyped]
6296
+ def values: () -> ::Array[V]
6297
6297
 
6298
6298
  # Checks if the dictionary has an ID.
6299
6299
  #
@@ -6759,13 +6759,13 @@ module Discorb
6759
6759
 
6760
6760
  #
6761
6761
  # Represents a slash command interaction.
6762
- class SlashCommand < Discorb::CommandInteraction
6762
+ class SlashCommand < Discorb::ApplicationCommandInteraction
6763
6763
  def _set_data: (untyped data) -> untyped
6764
6764
  end
6765
6765
 
6766
6766
  #
6767
6767
  # Represents a user context menu interaction.
6768
- class UserMenuCommand < Discorb::CommandInteraction
6768
+ class UserMenuCommand < Discorb::ApplicationCommandInteraction
6769
6769
  def _set_data: (untyped data) -> untyped
6770
6770
 
6771
6771
  # _@return_ — The target user.
@@ -6774,7 +6774,7 @@ module Discorb
6774
6774
 
6775
6775
  #
6776
6776
  # Represents a message context menu interaction.
6777
- class MessageMenuCommand < Discorb::CommandInteraction
6777
+ class MessageMenuCommand < Discorb::ApplicationCommandInteraction
6778
6778
  def _set_data: (untyped data) -> untyped
6779
6779
 
6780
6780
  # _@return_ — The target message.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discorb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sevenc-nanashi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-14 00:00:00.000000000 Z
11
+ date: 2021-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -74,6 +74,9 @@ executables:
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
78
+ - ".github/ISSUE_TEMPLATE/config.yml"
79
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
77
80
  - ".github/workflows/build_main.yml"
78
81
  - ".gitignore"
79
82
  - ".yardopts"
@@ -120,13 +123,13 @@ files:
120
123
  - examples/simple/wait_for_message.rb
121
124
  - exe/discorb
122
125
  - lib/discorb.rb
126
+ - lib/discorb/app_command.rb
123
127
  - lib/discorb/application.rb
124
128
  - lib/discorb/asset.rb
125
129
  - lib/discorb/audit_logs.rb
126
130
  - lib/discorb/channel.rb
127
131
  - lib/discorb/client.rb
128
132
  - lib/discorb/color.rb
129
- - lib/discorb/command.rb
130
133
  - lib/discorb/common.rb
131
134
  - lib/discorb/components.rb
132
135
  - lib/discorb/dictionary.rb