Class: OnyxCord::Events::ApplicationCommandEvent
- Inherits:
-
InteractionCreateEvent
- Object
- Event
- InteractionCreateEvent
- OnyxCord::Events::ApplicationCommandEvent
- Defined in:
- lib/onyxcord/events/interactions/application_commands.rb
Overview
Event for ApplicationCommand interactions.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#command_id ⇒ Integer
readonly
The ID of the command.
-
#command_name ⇒ Symbol
readonly
The name of the command.
-
#options ⇒ Hash<Symbol, Object>
readonly
Arguments provided to the command, mapped as
Name => Value. -
#resolved ⇒ Resolved
readonly
The resolved channels, roles, users, members, and attachments for this event.
-
#subcommand ⇒ Symbol?
readonly
The name of the subcommand relevant to this event.
-
#subcommand_group ⇒ Symbol?
readonly
The name of the subcommand group relevant to this event.
-
#target_id ⇒ Integer?
readonly
The target of this command when it is a context command.
Attributes inherited from InteractionCreateEvent
#channel, #channel_id, #context, #interaction, #server, #server_id, #server_integration?, #type, #user, #user_integration?, #user_locale
Attributes inherited from Event
Instance Method Summary collapse
-
#global_command? ⇒ true, false
Whether or not the application command that was executed has been registered globally.
-
#target ⇒ Message, ...
The target of this command, for context commands.
Methods inherited from InteractionCreateEvent
#defer, #defer_update, #delete_message, #delete_response, #edit_message, #edit_response, #get_component, #respond, #send_message, #show_modal, #update_message
Instance Attribute Details
#command_id ⇒ Integer (readonly)
Returns The ID of the command.
13 14 15 |
# File 'lib/onyxcord/events/interactions/application_commands.rb', line 13 def command_id @command_id end |
#command_name ⇒ Symbol (readonly)
Returns The name of the command.
10 11 12 |
# File 'lib/onyxcord/events/interactions/application_commands.rb', line 10 def command_name @command_name end |
#options ⇒ Hash<Symbol, Object> (readonly)
Returns Arguments provided to the command, mapped as Name => Value.
25 26 27 |
# File 'lib/onyxcord/events/interactions/application_commands.rb', line 25 def @options end |
#resolved ⇒ Resolved (readonly)
Returns The resolved channels, roles, users, members, and attachments for this event.
22 23 24 |
# File 'lib/onyxcord/events/interactions/application_commands.rb', line 22 def resolved @resolved end |
#subcommand ⇒ Symbol? (readonly)
Returns The name of the subcommand relevant to this event.
19 20 21 |
# File 'lib/onyxcord/events/interactions/application_commands.rb', line 19 def subcommand @subcommand end |
#subcommand_group ⇒ Symbol? (readonly)
Returns The name of the subcommand group relevant to this event.
16 17 18 |
# File 'lib/onyxcord/events/interactions/application_commands.rb', line 16 def subcommand_group @subcommand_group end |
#target_id ⇒ Integer? (readonly)
Returns The target of this command when it is a context command.
28 29 30 |
# File 'lib/onyxcord/events/interactions/application_commands.rb', line 28 def target_id @target_id end |
Instance Method Details
#global_command? ⇒ true, false
Returns Whether or not the application command that was executed has been registered globally. If this is false, then the application command that was executed is only available in the invoking server.
69 70 71 |
# File 'lib/onyxcord/events/interactions/application_commands.rb', line 69 def global_command? @command_server_id.nil? end |
#target ⇒ Message, ...
Returns The target of this command, for context commands.
74 75 76 77 78 |
# File 'lib/onyxcord/events/interactions/application_commands.rb', line 74 def target return nil unless @target_id @resolved.find { |data| data.key?(@target_id) }[@target_id] end |