Method: Discorb::ApplicationCommand::Handler#user_command

Defined in:
lib/discorb/app_command/handler.rb

#user_command(command_name, guild_ids: nil, &block) {|interaction, user| ... } ⇒ Discorb::ApplicationCommand::Command

Add user context menu command.

Parameters:

  • command_name (String)

    Command name.

  • guild_ids (Array<#to_s>, false, nil) (defaults to: nil)

    Guild IDs to set the command to. false to global command, nil to use default.

  • block (Proc)

    Command block.

Yields:

  • (interaction, user)

    Block to execute.

Yield Parameters:

Returns:



99
100
101
102
103
# File 'lib/discorb/app_command/handler.rb', line 99

def user_command(command_name, guild_ids: nil, &block)
  command = Discorb::ApplicationCommand::Command.new(command_name, guild_ids, block, 2)
  @commands << command
  command
end