Method: Discordrb::Events::ApplicationCommandEventHandler#group

Defined in:
lib/discordrb/events/interactions.rb

#group(name) {|| ... } ⇒ ApplicationCommandEventHandler

Parameters:

Yield Parameters:

Returns:

Raises:

  • (ArgumentError)


234
235
236
237
238
239
240
241
242
# File 'lib/discordrb/events/interactions.rb', line 234

def group(name)
  raise ArgumentError, 'Unable to mix subcommands and groups' if @subcommands.any? { |_, v| v.is_a? Proc }

  builder = SubcommandBuilder.new(name)
  yield builder

  @subcommands.merge!(builder.to_h)
  self
end