feat: email instruction checks AD mail attribute and shows available/unavailable message

This commit is contained in:
Денис Кривоченко
2026-07-30 13:51:33 +07:00
parent 1585206707
commit 90b4d554bb
2 changed files with 31 additions and 5 deletions
+12 -3
View File
@@ -18,7 +18,8 @@ from utils.texts import (
INSTRUCT_TRUECONF_TEXT,
INSTRUCT_TRUECONF_WITH_AD,
INSTRUCT_TRUECONF_PENDING_TEXT,
INSTRUCT_EMAIL_TEXT,
INSTRUCT_EMAIL_AVAILABLE,
INSTRUCT_EMAIL_UNAVAILABLE,
INSTRUCT_ERROR_MSG,
)
from utils.states import get_state, set_state, clear_state
@@ -427,8 +428,16 @@ async def instruct_router_handler(msg: Message):
await msg.answer(text, parse_mode="html")
elif cmd == "2":
log_menu_stats(user_id, "Инструкции", "Почта")
set_state(user_id, "INSTRUCT_EMAIL_VIEW")
await msg.answer(INSTRUCT_EMAIL_TEXT, parse_mode="html")
cn = get_user_cn(user_id)
if cn is None:
cn = user_id
ad_info = get_ad_user_info(user_id)
mail = ad_info.get("mail") if ad_info else None
if mail:
text = INSTRUCT_EMAIL_AVAILABLE(EMOJI_DIGITS, cn, mail)
else:
text = INSTRUCT_EMAIL_UNAVAILABLE(EMOJI_DIGITS, cn)
await msg.answer(text, parse_mode="html")
else:
await msg.answer(UNKNOWN_MAIN_CMD_TEXT, parse_mode="html")