From f7c71e2e2707bf06877594473b649ea0de71c470 Mon Sep 17 00:00:00 2001 From: Taras Terletskyi <888784+tropicoo@users.noreply.github.com> Date: Tue, 18 Oct 2022 02:55:22 +0300 Subject: [PATCH] Handle telegram video and animation uploads --- bot/core/tasks/upload.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bot/core/tasks/upload.py b/bot/core/tasks/upload.py index 1577f6f..89d8def 100644 --- a/bot/core/tasks/upload.py +++ b/bot/core/tasks/upload.py @@ -38,6 +38,7 @@ class UploadTask(AbstractTask): ) message = await self._upload_video_file() if message: + self._log.info(message) await self._save_cache(message) except Exception: self._log.exception('Something went wrong during video file upload') @@ -72,11 +73,12 @@ class UploadTask(AbstractTask): async def _save_cache(self, message: Message) -> None: self._log.debug('Saving telegram file cache - %s', message) + video = message.video or message.animation cache = CacheSchema( - cache_id=message.video.file_id, - cache_unique_id=message.video.file_unique_id, - file_size=message.video.file_size, - date_timestamp=message.video.date, + cache_id=video.file_id, + cache_unique_id=video.file_unique_id, + file_size=video.file_size, + date_timestamp=video.date, ) async for db in get_db():