fix: List only commands that are enabled in cmd response

Signed-off-by: Gerard Hickey <hickey@kinetic-compute.com>
This commit is contained in:
Gerard Hickey
2026-08-07 21:10:16 -04:00
parent 61da191fef
commit c61d628a1f
2 changed files with 9 additions and 0 deletions
+7
View File
@@ -543,6 +543,13 @@ class BaseCommand(ABC):
# Check if channel matches allowed list
return message_channel_normalized in allowed_normalized
def is_enabled(self) -> bool:
"""Return whether this command is enabled per config."""
for attr_name, attr_val in vars(self).items():
if attr_name.endswith('_enabled') and isinstance(attr_val, bool):
return attr_val
return True
def can_execute(self, message: MeshMessage, skip_channel_check: bool = False) -> bool:
"""Check if this command can be executed with the given message.
+2
View File
@@ -97,6 +97,8 @@ class CmdCommand(BaseCommand):
for cmd_name, cmd_instance in self.bot.command_manager.commands.items():
# Skip system commands without keywords (like greeter)
if hasattr(cmd_instance, 'keywords') and cmd_instance.keywords:
if hasattr(cmd_instance, 'is_enabled') and not cmd_instance.is_enabled():
continue
if not self._is_command_valid_for_channel(cmd_name, cmd_instance, message):
continue
all_commands.append(cmd_name)