Class: RubyCord::Command::GroupCommand
- Inherits:
-
RubyCord::Command
- Object
- DiscordModel
- RubyCord::Command
- RubyCord::Command::GroupCommand
- Defined in:
- lib/rubycord/command/group_command.rb
Direct Known Subclasses
Constant Summary
Constants inherited from RubyCord::Command
Instance Attribute Summary collapse
-
#commands ⇒ Array<RubyCord::Command>
readonly
The subcommands of the command.
-
#description ⇒ Hash{String => String}
readonly
The description of the command.
Attributes inherited from RubyCord::Command
#block, #default_permission, #dm_permission, #guild_ids, #name, #type, #type_raw
Instance Method Summary collapse
-
#group(command_name, description) {|group| ... } ⇒ RubyCord::Command::SubCommand
Add new subcommand group.
-
#slash(command_name, description, options = {}, dm_permission: true, default_permission: nil, &block) ⇒ RubyCord::Command::SlashCommand
Add new subcommand.
-
#to_s ⇒ String
Returns the command name.
Methods inherited from RubyCord::Command
Methods inherited from DiscordModel
Instance Attribute Details
#commands ⇒ Array<RubyCord::Command> (readonly)
Returns The subcommands of the command.
8 9 10 |
# File 'lib/rubycord/command/group_command.rb', line 8 def commands @commands end |
#description ⇒ Hash{String => String} (readonly)
Returns The description of the command.
10 11 12 |
# File 'lib/rubycord/command/group_command.rb', line 10 def description @description end |
Instance Method Details
#group(command_name, description) {|group| ... } ⇒ RubyCord::Command::SubCommand
Add new subcommand group.
84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/rubycord/command/group_command.rb', line 84 def group(command_name, description) command = RubyCord::Command::SubCommand.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) ⇒ RubyCord::Command::SlashCommand
Add new subcommand.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/rubycord/command/group_command.rb', line 48 def slash( command_name, description, = {}, dm_permission: true, default_permission: nil, &block ) command = RubyCord::Command::SlashCommand.new( command_name, description, , [], block, 1, self, , ) @client.callable_commands << command @commands << command command end |
#to_s ⇒ String
Returns the command name.
102 103 104 |
# File 'lib/rubycord/command/group_command.rb', line 102 def to_s @name["default"] end |