refactor(config): load reply templates on demand
This commit is contained in:
@@ -99,7 +99,6 @@ class Config:
|
|||||||
"max_retries": max_retries,
|
"max_retries": max_retries,
|
||||||
"enable_reply": enable_reply,
|
"enable_reply": enable_reply,
|
||||||
"skip_commented": skip_commented,
|
"skip_commented": skip_commented,
|
||||||
"reply_templates": self._load_replies(),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
except:
|
except:
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ class TelegramStarsBot:
|
|||||||
await asyncio.sleep(self.config.api_delay)
|
await asyncio.sleep(self.config.api_delay)
|
||||||
|
|
||||||
if poster_user_id:
|
if poster_user_id:
|
||||||
replies = self.config.reply_templates
|
replies = self.config._load_replies()
|
||||||
|
|
||||||
for reply_options in replies:
|
for reply_options in replies:
|
||||||
await asyncio.sleep(self.config.api_delay)
|
await asyncio.sleep(self.config.api_delay)
|
||||||
@@ -271,7 +271,9 @@ class TelegramStarsBot:
|
|||||||
await self._process_single_post(post)
|
await self._process_single_post(post)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
post_id = post.get("post_id", "?")
|
post_id = post.get("post_id", "?")
|
||||||
logger.error(f"Ошибка обработки поста {post_id}, пропускаю: {e}")
|
logger.error(
|
||||||
|
f"Ошибка обработки поста {post_id}, пропускаю: {e}"
|
||||||
|
)
|
||||||
if last_page > self.start_page:
|
if last_page > self.start_page:
|
||||||
logger.info(f"Мониторинг продвинулся до страницы {last_page}.")
|
logger.info(f"Мониторинг продвинулся до страницы {last_page}.")
|
||||||
self.start_page = last_page
|
self.start_page = last_page
|
||||||
|
|||||||
Reference in New Issue
Block a user