This commit is contained in:
user committed 2024-04-05 16:43:49 +03:00
1 parent 8ad43043da
commit 946b098867
3 files changed
+15 -5

No files matched your search

@@ -4,6 +4,7 @@ from app.core.logger import make_log
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
import json
@@ -88,6 +89,14 @@ class PlayerTemplates:
extra_buttons = []
make_log("TG-Player", f"Send content {content_type} ({content_encoding}) to chat {self._chat_id}. {cd_log}")
for kmsg in self.db_session.query(KnownTelegramMessage).filter_by(
content_id=content.id,
chat_id=self._chat_id,
message_type=f'content/{content_type}',
deleted=False
).all():
await self.delete_message(kmsg.message_id)
return 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,
@@ -97,3 +106,4 @@ class PlayerTemplates:
)