try send cached video
This commit is contained in:
parent
e3906c8ce0
commit
0f6c0fe09d
|
|
@ -158,13 +158,13 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use
|
|||
)
|
||||
elif content_type_declared == 'video':
|
||||
content_list.append(
|
||||
types.InlineQueryResultVideo(
|
||||
types.InlineQueryResultCachedVideo(
|
||||
id=f"NC_{content.id}",
|
||||
video_url=decrypted_content.web_url + '?seconds_limit=30',
|
||||
video_file_id=encrypted_content.meta['telegram_file_cache'],
|
||||
title=title,
|
||||
caption=hashtags_str + user.translated('p_playerContext_preview'),
|
||||
mime_type="video/mp4",
|
||||
thumbnail_url='https://raw.githubusercontent.com/my-mirror/assets/refs/heads/main/video_icon.png',
|
||||
# mime_type="video/mp4",
|
||||
# thumbnail_url='https://raw.githubusercontent.com/my-mirror/assets/refs/heads/main/video_icon.png',
|
||||
parse_mode='html',
|
||||
reply_markup=get_inline_keyboard([
|
||||
[{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue