Class: Discorb::ApplicationCommand::Command::GroupCommand
- Inherits:
-
Discorb::ApplicationCommand::Command
- Object
- DiscordModel
- Discorb::ApplicationCommand::Command
- Discorb::ApplicationCommand::Command::GroupCommand
- Defined in:
- lib/discorb/app_command.rb
Overview
Represents the command with subcommands.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#commands -> Array<Discorb::ApplicationCommand::Command::SlashCommand, Discorb::ApplicationCommand::Command::SubcommandGroup>
readonly
The subcommands of the command.
-
#description -> String
readonly
The description of the command.
Attributes inherited from Discorb::ApplicationCommand::Command
#block, #guild_ids, #id_map, #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 = {}, &block) -> Discorb::ApplicationCommand::Command::SlashCommand
Add new subcommand.
-
#to_s -> String
Returns the command name.
Methods inherited from DiscordModel
Instance Attribute Details
#commands -> Array<Discorb::ApplicationCommand::Command::SlashCommand, Discorb::ApplicationCommand::Command::SubcommandGroup> (readonly)
Returns The subcommands of the command.
257 258 259 |
# File 'lib/discorb/app_command.rb', line 257 def commands @commands end |
#description -> String (readonly)
Returns The description of the command.
259 260 261 |
# File 'lib/discorb/app_command.rb', line 259 def description @description end |
Instance Method Details
#group(command_name, description) {|group| ... } ⇒ Discorb::ApplicationCommand::Command::SubcommandGroup
Add new subcommand group.
296 297 298 299 300 301 |
# File 'lib/discorb/app_command.rb', line 296 def group(command_name, description, &block) command = Discorb::ApplicationCommand::Command::SubcommandGroup.new(command_name, description, @name, @client) command.yield_self(&block) if block_given? @commands << command command end |
#slash(command_name, description, options = {}, &block) -> Discorb::ApplicationCommand::Command::SlashCommand
Add new subcommand.
276 277 278 279 280 281 |
# File 'lib/discorb/app_command.rb', line 276 def slash(command_name, description, = {}, &block) command = Discorb::ApplicationCommand::Command::SlashCommand.new(command_name, description, , [], block, 1, @name) @client.bottom_commands << command @commands << command command end |
#to_s -> String
Returns the command name.
308 309 310 |
# File 'lib/discorb/app_command.rb', line 308 def to_s @name end |