Class: OnyxCord::Events::ApplicationCommandEventHandler
- Inherits:
-
EventHandler
- Object
- EventHandler
- OnyxCord::Events::ApplicationCommandEventHandler
show all
- Defined in:
- lib/onyxcord/events/interactions/application_commands.rb
Overview
Event handler for ApplicationCommandEvents.
Instance Attribute Summary collapse
Instance Method Summary
collapse
#after_call, #match, #matches_all
Instance Attribute Details
#subcommands ⇒ Hash
92
93
94
|
# File 'lib/onyxcord/events/interactions/application_commands.rb', line 92
def subcommands
@subcommands
end
|
Instance Method Details
104
105
106
107
108
109
110
111
112
|
# File 'lib/onyxcord/events/interactions/application_commands.rb', line 104
def group(name)
raise ArgumentError, 'Unable to mix subcommands and groups' if @subcommands.any? { |n, v| n == name && v.is_a?(Proc) }
builder = SubcommandBuilder.new(name)
yield builder
@subcommands.merge!(builder.to_h)
self
end
|
117
118
119
120
121
122
123
|
# File 'lib/onyxcord/events/interactions/application_commands.rb', line 117
def subcommand(name, &block)
raise ArgumentError, 'Unable to mix subcommands and groups' if @subcommands.any? { |n, v| n == name && v.is_a?(Hash) }
@subcommands[name.to_sym] = block
self
end
|