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:
agessaman
2026-06-28 08:42:58 -07:00
parent 6584800cb7
commit 24fdfb2370
8 changed files with 171 additions and 12 deletions
+9
View File
@@ -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']