diff --git a/src/bot/handlers/abstract_command_handler.py b/src/bot/handlers/abstract_command_handler.py index e9f6742..2732ef3 100644 --- a/src/bot/handlers/abstract_command_handler.py +++ b/src/bot/handlers/abstract_command_handler.py @@ -21,7 +21,16 @@ class AbstractCommandHandler(ABC): COMMAND (`str`): The name of the command that this handler handles. """ - COMMAND: str = "" + @property + @abstractmethod + def COMMAND(self) -> str: + """ + The name of the command that this handler handles. + + Returns: + str: The command name. + """ + pass @abstractmethod def get_filters(self) -> Filter: diff --git a/src/bot/handlers/ai_command_handler.py b/src/bot/handlers/ai_command_handler.py index de4ff71..60d06dd 100644 --- a/src/bot/handlers/ai_command_handler.py +++ b/src/bot/handlers/ai_command_handler.py @@ -19,14 +19,11 @@ class AICommandHandler(AbstractCommandHandler): and returns the generated response. Attributes: + COMMAND (`str`): The name of the command that this handler handles. logger (`Logger`): Logger instance for logging events. gigachat_client (`GigaChatClient`): Client for interacting with the GigaChat API. - COMMAND (`str`): The name of the command that this handler handles. """ - # The name of the command that this handler handles - COMMAND: str = "ai" - def __init__(self, logger: Logger, gigachat_client: GigaChatClient) -> None: """ Initializes the AICommandHandler. @@ -37,6 +34,16 @@ class AICommandHandler(AbstractCommandHandler): """ self.logger: Logger = logger self.gigachat_client: GigaChatClient = gigachat_client + + @property + def COMMAND(self) -> str: + """ + The name of the command that this handler handles. + + Returns: + str: The command name. + """ + return "ai" def get_filters(self) -> Filter: """ diff --git a/src/bot/handlers/video_command_handler.py b/src/bot/handlers/video_command_handler.py index 2c9349f..dc71074 100644 --- a/src/bot/handlers/video_command_handler.py +++ b/src/bot/handlers/video_command_handler.py @@ -29,9 +29,6 @@ class VideoCommandHandler(AbstractCommandHandler): logger (`Logger`): Logger instance for logging events. """ - # The name of the command that this handler handles - COMMAND: str = "video" - # Mapping of language codes to their aliases LANGUAGE_ALIASES: dict[str, list[str]] = { "en": ["en", "eng", "english"], @@ -61,6 +58,16 @@ class VideoCommandHandler(AbstractCommandHandler): `pyrogram.filters.Filter`: A Pyrogram filter matching the /video command. """ return filters.command(self.COMMAND) + + @property + def COMMAND(self) -> str: + """ + The name of the command that this handler handles. + + Returns: + str: The command name. + """ + return "video" async def handle(self, client: Client, message: Message) -> None: """ diff --git a/src/bot/handlers/voice_command_handler.py b/src/bot/handlers/voice_command_handler.py index 80cb594..0fe00fa 100644 --- a/src/bot/handlers/voice_command_handler.py +++ b/src/bot/handlers/voice_command_handler.py @@ -27,9 +27,6 @@ class VoiceCommandHandler(AbstractCommandHandler): logger (`Logger`): Logger instance for logging events. """ - # The name of the command that this handler handles - COMMAND: str = "voice" - # Mapping of language codes to their aliases LANGUAGE_ALIASES: dict[str, list[str]] = { "en": ["en", "eng", "english"], @@ -50,6 +47,16 @@ class VoiceCommandHandler(AbstractCommandHandler): logger (`Logger`): Logger instance for logging events. """ self.logger: Logger = logger + + @property + def COMMAND(self) -> str: + """ + The name of the command that this handler handles. + + Returns: + str: The command name. + """ + return "voice" def get_filters(self) -> Filter: """