Class: Discorb::ApplicationCommand::Command::GroupCommand
- Inherits:
-
Discorb::ApplicationCommand::Command
- Object
- DiscordModel
- Discorb::ApplicationCommand::Command
- Discorb::ApplicationCommand::Command::GroupCommand
- Defined in:
- lib/discorb/app_command/command.rb
Overview
Represents the command with subcommands.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#commands -> Array<Discorb::ApplicationCommand::Command>
readonly
The subcommands of the command.
-
#description -> Hash{String => String}
readonly
The description of the command.
Attributes inherited from Discorb::ApplicationCommand::Command
#block, #default_permission, #dm_permission, #guild_ids, #name, #type, #type_raw
Instance Method Summary collapse
-
#group(command_name, description) {|group| ... } ⇒ Discorb::ApplicationCommand::Command::SubcommandGroup
Add new subcommand group.
-
#slash(command_name, description, options = {}, dm_permission: true, default_permission: nil, &block) -> Discorb::ApplicationCommand::Command::ChatInputCommand
Add new subcommand.
-
#to_s -> String
Returns the command name.
Methods inherited from DiscordModel
Instance Attribute Details
#commands -> Array<Discorb::ApplicationCommand::Command> (readonly)
Returns The subcommands of the command.
254 255 256 |
# File 'lib/discorb/app_command/command.rb', line 254 def commands @commands end |
#description -> Hash{String => String} (readonly)
Returns The description of the command.
256 257 258 |
# File 'lib/discorb/app_command/command.rb', line 256 def description @description end |
Instance Method Details
#group(command_name, description) {|group| ... } ⇒ Discorb::ApplicationCommand::Command::SubcommandGroup
Add new subcommand group.
332 333 334 335 336 337 338 339 340 341 342 343 |
# File 'lib/discorb/app_command/command.rb', line 332 def group(command_name, description) command = Discorb::ApplicationCommand::Command::SubcommandGroup.new( command_name, description, self, @client ) yield command if block_given? @commands << command command end |
#slash(command_name, description, options = {}, dm_permission: true, default_permission: nil, &block) -> Discorb::ApplicationCommand::Command::ChatInputCommand
Add new subcommand.
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
# File 'lib/discorb/app_command/command.rb', line 294 def slash( command_name, description, = {}, dm_permission: true, default_permission: nil, &block ) command = Discorb::ApplicationCommand::Command::ChatInputCommand.new( command_name, description, , [], block, 1, self, , ) @client.callable_commands << command @commands << command command end |
#to_s -> String
Returns the command name.
350 351 352 |
# File 'lib/discorb/app_command/command.rb', line 350 def to_s @name["default"] end |