diff --git a/lib/discordrb/events/interactions.rb b/lib/discordrb/events/interactions.rb index c10a11e9e..0b9df9f8a 100644 --- a/lib/discordrb/events/interactions.rb +++ b/lib/discordrb/events/interactions.rb @@ -246,7 +246,7 @@ def initialize(attributes, block) # @yieldparam [SubcommandBuilder] # @return [ApplicationCommandEventHandler] def group(name) - raise ArgumentError, 'Unable to mix subcommands and groups' if @subcommands.any? { |_, v| v.is_a? Proc } + 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 @@ -259,7 +259,7 @@ def group(name) # @yieldparam [SubcommandBuilder] # @return [ApplicationCommandEventHandler] def subcommand(name, &block) - raise ArgumentError, 'Unable to mix subcommands and groups' if @subcommands.any? { |_, v| v.is_a? Hash } + raise ArgumentError, 'Unable to mix subcommands and groups' if @subcommands.any? { |n, v| n == name && v.is_a?(Hash) } @subcommands[name.to_sym] = block