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:



284
285
286
# File 'lib/discordrb/data/interaction.rb', line 284

def application_id
  @application_id
end

#default_permissiontrue, false (readonly)

Returns:

  • (true, false)


296
297
298
# File 'lib/discordrb/data/interaction.rb', line 296

def default_permission
  @default_permission
end

#descriptionString (readonly)

Returns:



293
294
295
# File 'lib/discordrb/data/interaction.rb', line 293

def description
  @description
end

#idInteger (readonly)

Returns:



302
303
304
# File 'lib/discordrb/data/interaction.rb', line 302

def id
  @id
end

#nameString (readonly)

Returns:



290
291
292
# File 'lib/discordrb/data/interaction.rb', line 290

def name
  @name
end

#optionsHash (readonly)

Returns:

  • (Hash)


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

def options
  @options
end

#server_idInteger? (readonly)

Returns:



287
288
289
# File 'lib/discordrb/data/interaction.rb', line 287

def server_id
  @server_id
end

Instance Method Details

#deleteObject

Delete this application command.



328
329
330
# File 'lib/discordrb/data/interaction.rb', line 328

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

#edit(name: nil, description: nil, default_permission: nil) {|, | ... } ⇒ 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.

Yield Parameters:

  • (OptionBuilder)
  • (PermissionBuilder)


322
323
324
# File 'lib/discordrb/data/interaction.rb', line 322

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