fix: send email text then attach docs without caption
This commit is contained in:
+5
-11
@@ -447,23 +447,17 @@ async def instruct_router_handler(msg: Message):
|
|||||||
raw_mail = ad_info.get("raw_mail") if ad_info else None
|
raw_mail = ad_info.get("raw_mail") if ad_info else None
|
||||||
if raw_mail:
|
if raw_mail:
|
||||||
text = INSTRUCT_EMAIL_AVAILABLE(EMOJI_DIGITS, cn, raw_mail)
|
text = INSTRUCT_EMAIL_AVAILABLE(EMOJI_DIGITS, cn, raw_mail)
|
||||||
# Собираем список документов для отправки группой
|
# Отправляем текст сообщения
|
||||||
media_list = []
|
await msg.answer(text, parse_mode="html")
|
||||||
|
# Затем отправляем оба документа
|
||||||
for instruct_path, file_name in [
|
for instruct_path, file_name in [
|
||||||
(GMAIL_ANDROID_INSTRUCT_PATH, "Инструкция Android"),
|
(GMAIL_ANDROID_INSTRUCT_PATH, "Инструкция Android"),
|
||||||
(APPLE_INSTRUCT_PATH, "Инструкция Apple"),
|
(APPLE_INSTRUCT_PATH, "Инструкция Apple"),
|
||||||
]:
|
]:
|
||||||
if os.path.isfile(instruct_path):
|
if os.path.isfile(instruct_path):
|
||||||
media_list.append({
|
await msg.bot.send_document(
|
||||||
"type": "document",
|
|
||||||
"media": instruct_path,
|
|
||||||
"caption": text,
|
|
||||||
"parse_mode": "html",
|
|
||||||
})
|
|
||||||
if media_list:
|
|
||||||
await msg.bot.send_media_group(
|
|
||||||
chat_id=msg.chat_id,
|
chat_id=msg.chat_id,
|
||||||
media=media_list,
|
file=FSInputFile(instruct_path, file_name=file_name),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
text = INSTRUCT_EMAIL_UNAVAILABLE(EMOJI_DIGITS, cn)
|
text = INSTRUCT_EMAIL_UNAVAILABLE(EMOJI_DIGITS, cn)
|
||||||
|
|||||||
Reference in New Issue
Block a user