feat: Add command enable/disable configuration for various commands

- Implemented a configuration option for enabling or disabling commands across multiple command classes.
- Each command now checks its enabled state before execution, improving control over command availability.
- Updated the configuration loading mechanism to retrieve the enabled state from the config file for commands like Advert, AQI, Catfact, and others.
This commit is contained in:
agessaman committed 2026-01-10 09:33:15 -08:00
1 parent 7ee77c16c0
commit cc3fffeb54
25 files changed
+417 -10

No files matched your search

+19
View File
@@ -27,6 +27,9 @@ class HelloCommand(BaseCommand):
"""
super().__init__(bot)
# Load configuration
self.hello_enabled = self.get_config_value('Hello_Command', 'enabled', fallback=True, value_type='bool')
# Fallback arrays if translations not available
self._init_fallback_arrays()
@@ -353,6 +356,22 @@ class HelloCommand(BaseCommand):
return bool(re.match(defined_emoji_pattern, cleaned_text))
def can_execute(self, message: MeshMessage) -> bool:
"""Check if this command can be executed with the given message.
Args:
message: The message triggering the command.
Returns:
bool: True if command is enabled and checks pass, False otherwise.
"""
# Check if hello command is enabled
if not self.hello_enabled:
return False
# Call parent can_execute() which includes channel checking, cooldown, etc.
return super().can_execute(message)
def get_emoji_response(self, text: str, bot_name: str) -> str:
"""Get appropriate response for emoji-only message"""
import random