mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-08-29 07:08:45 +00:00
feat(command_manager, help_command): improve command prefix handling and help command visibility
- Enhanced `CommandManager` to persist normalized message content, preventing prefix stripping from interfering with command matching. - Updated `BaseCommand` to skip prefix handling if already normalized, ensuring all commands can be matched correctly. - Modified `HelpCommand` to ensure unused commands are listed even when command statistics are present, improving user accessibility to all commands. - Added unit tests to verify the correct behavior of command matching and help command functionality under various scenarios.
This commit is contained in:
@@ -705,6 +705,15 @@ class CommandManager:
|
||||
|
||||
content_lower = content.lower()
|
||||
|
||||
# Persist the normalized (prefix-stripped) content to the shared message once,
|
||||
# before iterating commands. Each command's cleanup_message_for_matching would
|
||||
# otherwise re-strip/re-reject the prefix off this same object; the first
|
||||
# keyword command would consume the prefix and break matching for every command
|
||||
# after it. The flag tells per-command cleanup the prefix is already handled.
|
||||
message.content = content
|
||||
message.content_lower = content_lower
|
||||
message.prefix_normalized = True
|
||||
|
||||
# Check for help requests first (special handling)
|
||||
# Check both English "help" and translated help keywords
|
||||
help_keywords = ['help']
|
||||
|
||||
Reference in New Issue
Block a user