From bb6cc70be97868e84c170eb76ce3f38224cd49a0 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 30 Jul 2026 04:47:32 +0500 Subject: [PATCH] refactor(config): load reply templates on demand --- config.py | 1 - modules/stars_bot.py | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config.py b/config.py index 3dca59f..ed32d90 100644 --- a/config.py +++ b/config.py @@ -99,7 +99,6 @@ class Config: "max_retries": max_retries, "enable_reply": enable_reply, "skip_commented": skip_commented, - "reply_templates": self._load_replies(), } except: diff --git a/modules/stars_bot.py b/modules/stars_bot.py index a341244..33a3edd 100644 --- a/modules/stars_bot.py +++ b/modules/stars_bot.py @@ -214,7 +214,7 @@ class TelegramStarsBot: await asyncio.sleep(self.config.api_delay) if poster_user_id: - replies = self.config.reply_templates + replies = self.config._load_replies() for reply_options in replies: await asyncio.sleep(self.config.api_delay) @@ -271,7 +271,9 @@ class TelegramStarsBot: await self._process_single_post(post) except Exception as e: post_id = post.get("post_id", "?") - logger.error(f"Ошибка обработки поста {post_id}, пропускаю: {e}") + logger.error( + f"Ошибка обработки поста {post_id}, пропускаю: {e}" + ) if last_page > self.start_page: logger.info(f"Мониторинг продвинулся до страницы {last_page}.") self.start_page = last_page