fix: use send_media_group to send both email instructions in one group

This commit is contained in:
Денис Кривоченко
2026-07-30 14:24:42 +07:00
parent 5f604e52d8
commit 597aa56651
+11 -5
View File
@@ -447,17 +447,23 @@ async def instruct_router_handler(msg: Message):
raw_mail = ad_info.get("raw_mail") if ad_info else None
if raw_mail:
text = INSTRUCT_EMAIL_AVAILABLE(EMOJI_DIGITS, cn, raw_mail)
# Отправляем текст один раз
await msg.answer(text, parse_mode="html")
# Затем отправляем обе инструкции
# Собираем список документов для отправки группой
media_list = []
for instruct_path, file_name in [
(GMAIL_ANDROID_INSTRUCT_PATH, "Инструкция Android"),
(APPLE_INSTRUCT_PATH, "Инструкция Apple"),
]:
if os.path.isfile(instruct_path):
await msg.bot.send_document(
media_list.append({
"type": "document",
"media": instruct_path,
"caption": text,
"parse_mode": "html",
})
if media_list:
await msg.bot.send_media_group(
chat_id=msg.chat_id,
file=FSInputFile(instruct_path, file_name=file_name),
media=media_list,
)
else:
text = INSTRUCT_EMAIL_UNAVAILABLE(EMOJI_DIGITS, cn)