Class: Discordrb::ApplicationCommand
- Inherits:
-
Object
- Object
- Discordrb::ApplicationCommand
- 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
andmessage
types appear as context menus for the respective resource. { chat_input: 1, user: 2, message: 3 }.freeze
Instance Attribute Summary collapse
- #application_id ⇒ Integer readonly
- #default_permission ⇒ true, false readonly
- #description ⇒ String readonly
- #id ⇒ Integer readonly
- #name ⇒ String readonly
- #options ⇒ Hash readonly
- #server_id ⇒ Integer? readonly
Instance Method Summary collapse
-
#delete ⇒ Object
Delete this application command.
- #edit(name: nil, description: nil, default_permission: nil) {|, | ... } ⇒ Object
-
#mention(subcommand_group: nil, subcommand: nil) ⇒ String
(also: #to_s)
The layout to mention it in a message.
Instance Attribute Details
#application_id ⇒ Integer (readonly)
322 323 324 |
# File 'lib/discordrb/data/interaction.rb', line 322 def application_id @application_id end |
#default_permission ⇒ true, false (readonly)
334 335 336 |
# File 'lib/discordrb/data/interaction.rb', line 334 def @default_permission end |
#description ⇒ String (readonly)
331 332 333 |
# File 'lib/discordrb/data/interaction.rb', line 331 def description @description end |
#id ⇒ Integer (readonly)
340 341 342 |
# File 'lib/discordrb/data/interaction.rb', line 340 def id @id end |
#name ⇒ String (readonly)
328 329 330 |
# File 'lib/discordrb/data/interaction.rb', line 328 def name @name end |
#options ⇒ Hash (readonly)
337 338 339 |
# File 'lib/discordrb/data/interaction.rb', line 337 def @options end |
#server_id ⇒ Integer? (readonly)
325 326 327 |
# File 'lib/discordrb/data/interaction.rb', line 325 def server_id @server_id end |
Instance Method Details
#delete ⇒ Object
Delete this application command.
383 384 385 |
# File 'lib/discordrb/data/interaction.rb', line 383 def delete @bot.delete_application_command(@id, server_id: @server_id) end |
#edit(name: nil, description: nil, default_permission: nil) {|, | ... } ⇒ Object
377 378 379 |
# File 'lib/discordrb/data/interaction.rb', line 377 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: , &block) end |
#mention(subcommand_group: nil, subcommand: nil) ⇒ String Also known as: to_s
Returns the layout to mention it in a message.
358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/discordrb/data/interaction.rb', line 358 def mention(subcommand_group: nil, subcommand: nil) if subcommand_group && subcommand "</#{name} #{subcommand_group} #{subcommand}:#{id}>" elsif subcommand_group "</#{name} #{subcommand_group}:#{id}>" elsif subcommand "</#{name} #{subcommand}:#{id}>" else "</#{name}:#{id}>" end end |