Class: Discordrb::ApplicationCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/data/interaction.rb

Overview

An ApplicationCommand for slash commands.

Constant Summary collapse

TYPES =

Command types. chat_input is a command that appears in the text input field. user and message types appear as context menus for the respective resource.

{
  chat_input: 1,
  user: 2,
  message: 3
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#application_idInteger (readonly)

Returns:



264
265
266
# File 'lib/discordrb/data/interaction.rb', line 264

def application_id
  @application_id
end

#default_permissiontrue, false (readonly)

Returns:

  • (true, false)


276
277
278
# File 'lib/discordrb/data/interaction.rb', line 276

def default_permission
  @default_permission
end

#descriptionString (readonly)

Returns:



273
274
275
# File 'lib/discordrb/data/interaction.rb', line 273

def description
  @description
end

#nameString (readonly)

Returns:



270
271
272
# File 'lib/discordrb/data/interaction.rb', line 270

def name
  @name
end

#optionsHash (readonly)

Returns:

  • (Hash)


279
280
281
# File 'lib/discordrb/data/interaction.rb', line 279

def options
  @options
end

#server_idInteger? (readonly)

Returns:



267
268
269
# File 'lib/discordrb/data/interaction.rb', line 267

def server_id
  @server_id
end

Instance Method Details

#deleteObject

Delete this application command.



305
306
307
# File 'lib/discordrb/data/interaction.rb', line 305

def delete
  @bot.delete_application_command(@id, server_id: @server_id)
end

#edit(name: nil, description: nil, default_permission: nil, &block) ⇒ Object

Parameters:

  • name (String) (defaults to: nil)

    The name to use for this command.

  • description (String) (defaults to: nil)

    The description of this command.

  • default_permission (true, false) (defaults to: nil)

    Whether this command is available with default permissions.



299
300
301
# File 'lib/discordrb/data/interaction.rb', line 299

def edit(name: nil, description: nil, default_permission: nil, &block)
  @bot.edit_application_command(@id, server_id: @server_id, name: name, description: description, default_permission: default_permission, &block)
end