Class: RubyCord::Command::SubCommand

Inherits:
GroupCommand show all
Defined in:
lib/rubycord/command/sub_command.rb

Constant Summary

Constants inherited from RubyCord::Command

VALID_LOCALES

Instance Attribute Summary collapse

Attributes inherited from GroupCommand

#description

Attributes inherited from RubyCord::Command

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

Instance Method Summary collapse

Methods inherited from GroupCommand

#group

Methods inherited from RubyCord::Command

modify_localization_hash

Methods inherited from DiscordModel

#==, #eql?, #inspect

Instance Attribute Details

#commandsArray<RubyCord::Command::SlashCommand> (readonly)

Returns The subcommands of the command.

Returns:



8
9
10
# File 'lib/rubycord/command/sub_command.rb', line 8

def commands
  @commands
end

Instance Method Details

#slash(command_name, description, options = {}, &block) ⇒ RubyCord::Command::SlashCommand

Add new subcommand.

Returns:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/rubycord/command/sub_command.rb', line 34

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

#to_sObject



25
26
27
# File 'lib/rubycord/command/sub_command.rb', line 25

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