Class: Discordrb::Events::ApplicationCommandEvent
- Inherits:
-
InteractionCreateEvent
- Object
- Event
- InteractionCreateEvent
- Discordrb::Events::ApplicationCommandEvent
- Defined in:
- lib/discordrb/events/interactions.rb
Overview
Event for ApplicationCommand interactions.
Direct Known Subclasses
Defined Under Namespace
Classes: Resolved
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
-
#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, #interaction, #server, #server_id, #type, #user
Attributes inherited from Event
Instance Method Summary collapse
-
#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.
134 135 136 |
# File 'lib/discordrb/events/interactions.rb', line 134 def command_id @command_id end |
#command_name ⇒ Symbol (readonly)
Returns The name of the command.
131 132 133 |
# File 'lib/discordrb/events/interactions.rb', line 131 def command_name @command_name end |
#options ⇒ Hash<Symbol, Object> (readonly)
Returns Arguments provided to the command, mapped as Name => Value
.
146 147 148 |
# File 'lib/discordrb/events/interactions.rb', line 146 def @options end |
#resolved ⇒ Resolved (readonly)
143 144 145 |
# File 'lib/discordrb/events/interactions.rb', line 143 def resolved @resolved end |
#subcommand ⇒ Symbol? (readonly)
Returns The name of the subcommand relevant to this event.
140 141 142 |
# File 'lib/discordrb/events/interactions.rb', line 140 def subcommand @subcommand end |
#subcommand_group ⇒ Symbol? (readonly)
Returns The name of the subcommand group relevant to this event.
137 138 139 |
# File 'lib/discordrb/events/interactions.rb', line 137 def subcommand_group @subcommand_group end |
#target_id ⇒ Integer? (readonly)
Returns The target of this command when it is a context command.
149 150 151 |
# File 'lib/discordrb/events/interactions.rb', line 149 def target_id @target_id end |
Instance Method Details
#target ⇒ Message, ...
Returns The target of this command, for context commands.
187 188 189 190 191 |
# File 'lib/discordrb/events/interactions.rb', line 187 def target return nil unless @target_id @resolved.find { |data| data.key?(@target_id) }[@target_id] end |