refactor: streamline captcha and thread access
Build and Push (dev) / build (push) Successful in 1m29s

This commit is contained in:
2026-08-08 04:03:32 +05:00
parent 0cc2440736
commit 7e85a1af4c
3 changed files with 15 additions and 9 deletions
+5 -3
View File
@@ -51,14 +51,14 @@ class Config:
default_captcha = (
f"[CENTER][B]Напишите ответ:[/B]\n"
f"сколько будет 20 + 20? [I][COLOR=rgb(80, 80, 78)](Капча меняется раз в месяц)[/COLOR][/I][/CENTER]"
)
).strip()
try:
captcha = ""
with open(file_path, "r", encoding="utf-8") as replies:
captcha = replies.read()
return captcha if captcha else default_captcha
return captcha.strip() if captcha else default_captcha
except FileNotFoundError:
return default_captcha
@@ -133,7 +133,9 @@ class Config:
# Validate captcha configuration
if enable_captcha and not captcha_answer:
raise ConfigError("ENABLE_CAPTCHA установлен, но CAPTCHA_ANSWER не задан")
raise ConfigError(
"ENABLE_CAPTCHA установлен, но CAPTCHA_ANSWER не задан"
)
return {
# Pyrogram