Class: Discorb::ApplicationCommand::Command::SubcommandGroup

Inherits:
GroupCommand show all
Defined in:
lib/discorb/app_command/command.rb

Overview

Represents the subcommand group.

Instance Attribute Summary collapse

Attributes inherited from GroupCommand

#description

Attributes inherited from Discorb::ApplicationCommand::Command

#block, #default_permission, #dm_permission, #guild_ids, #name, #type, #type_raw

Instance Method Summary collapse

Methods inherited from GroupCommand

#group

Methods inherited from DiscordModel

#==, #eql?, #inspect

Instance Attribute Details

#commands -> Array<Discorb::ApplicationCommand::Command::ChatInputCommand> (readonly)

Returns The subcommands of the command.

Returns:



360
361
362
# File 'lib/discorb/app_command/command.rb', line 360

def commands
  @commands
end

Instance Method Details

#slash(command_name, description, options = {}, &block) -> Discorb::ApplicationCommand::Command::ChatInputCommand

Add new subcommand.

Returns:



386
387
388
389
390
391
392
393
394
# File 'lib/discorb/app_command/command.rb', line 386

def slash(command_name, description, options = {}, &block)
  command = Discorb::ApplicationCommand::Command::ChatInputCommand.new(
    command_name, description, options, [],
    block, 1, self, nil, nil
  )
  @commands << command
  @client.callable_commands << command
  command
end

#to_s -> Object



377
378
379
# File 'lib/discorb/app_command/command.rb', line 377

def to_s
  "#{@parent} #{@name}"
end