mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-09-17 05:04:19 +00:00
fix(command_manager): prevent a disabled command from swallowing a keyword preventing an alias from firing
Removed redundant logging for command execution and added detailed debug logging for cases where a command cannot execute due to soft rejections. This allows for better tracking of command flow and ensures that keyword matching continues for subsequent commands. Updated the test_command to include config aliases in keyword matching, enhancing its flexibility.
This commit is contained in:
@@ -2009,8 +2009,6 @@ class CommandManager:
|
||||
# This command was already handled by keyword matching
|
||||
continue
|
||||
|
||||
self.logger.info(f"Command '{command_name}' matched, executing")
|
||||
|
||||
# Check if we should queue instead of reject (for global cooldowns near expiring)
|
||||
should_queue, remaining = self._should_queue_command(command, message)
|
||||
if should_queue and self._queue_command(command, message, remaining):
|
||||
@@ -2054,7 +2052,17 @@ class CommandManager:
|
||||
await self.send_response(message, error_msg)
|
||||
response_sent = True
|
||||
|
||||
# Record command execution in stats database (even if it failed checks)
|
||||
# Soft rejection (e.g. enabled=false): do not claim the keyword.
|
||||
# Matches check_keywords(), which continues so another command's
|
||||
# alias can handle the same trigger (e.g. test aliases=path with
|
||||
# Path_Command disabled).
|
||||
if not response_sent:
|
||||
self.logger.debug(
|
||||
f"Command '{command_name}' matched but cannot execute; trying next"
|
||||
)
|
||||
continue
|
||||
|
||||
# Record command execution in stats database (hard rejection with user feedback)
|
||||
if 'stats' in self.commands:
|
||||
stats_command = self.commands['stats']
|
||||
if stats_command:
|
||||
@@ -2062,6 +2070,8 @@ class CommandManager:
|
||||
|
||||
return
|
||||
|
||||
self.logger.info(f"Command '{command_name}' matched, executing")
|
||||
|
||||
# Check network connectivity for commands that require internet
|
||||
if command.requires_internet:
|
||||
has_internet = await self._check_internet_cached_async()
|
||||
|
||||
Reference in New Issue
Block a user