try send cached video

This commit is contained in:
user committed 2025-02-05 11:00:07 +03:00
1 parent e3906c8ce0
commit 0f6c0fe09d
2 files changed
+20 -6

No files matched your search

+16 -2
View File
@@ -5,7 +5,7 @@ from app.core._utils.tg_process_template import tg_process_template
from app.core._config import PROJECT_HOST, CLIENT_TELEGRAM_BOT_USERNAME
from app.core._keyboards import get_inline_keyboard
from app.core.models.messages import KnownTelegramMessage
from aiogram.types import URLInputFile
from aiogram.types import URLInputFile, Message
import json
@@ -150,7 +150,7 @@ class PlayerTemplates:
).all():
await self.delete_message(kmsg.message_id)
return await tg_process_template(
r = await tg_process_template(
self, text, message_id=message_id, **template_kwargs,
keyboard=get_inline_keyboard([*inline_keyboard_array, *extra_buttons]) if inline_keyboard_array else None,
message_type=f'content/{content_type}',
@@ -158,5 +158,19 @@ class PlayerTemplates:
content_id=content.id if content else None
)
if self.bot_id == 1:
if content_type == 'audio':
content.meta = {
**content.meta,
'telegram_file_cache': r.audio.file_id,
}
elif content_type == 'video':
content.meta = {
**content.meta,
'telegram_file_cache': r.video.file_id,
}
return r