Method: Discordrb::Events::ApplicationCommandEventHandler#subcommand

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

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

Parameters:

Yield Parameters:

Returns:

Raises:

  • (ArgumentError)


247
248
249
250
251
252
253
# File 'lib/discordrb/events/interactions.rb', line 247

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

  @subcommands[name.to_sym] = block

  self
end