From f1298dfdc67c51bf31cf436db1512749b5447e60 Mon Sep 17 00:00:00 2001 From: Roj Date: Sat, 29 Jan 2022 16:08:15 +0300 Subject: [PATCH] Add video_start_ts parameter to set_chat_photo (#770) * Add `video_start_ts` parameter to `set_chat_photo` * Docstrings update Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com> --- pyrogram/methods/chats/set_chat_photo.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pyrogram/methods/chats/set_chat_photo.py b/pyrogram/methods/chats/set_chat_photo.py index 266253d6..a1fee7f6 100644 --- a/pyrogram/methods/chats/set_chat_photo.py +++ b/pyrogram/methods/chats/set_chat_photo.py @@ -31,7 +31,8 @@ class SetChatPhoto(Scaffold): chat_id: Union[int, str], *, photo: Union[str, BinaryIO] = None, - video: Union[str, BinaryIO] = None + video: Union[str, BinaryIO] = None, + video_start_ts: float = None, ) -> bool: """Set a new chat photo or video (H.264/MPEG-4 AVC video, max 5 seconds). @@ -54,6 +55,9 @@ class SetChatPhoto(Scaffold): from your local machine or a binary file-like object with its attribute ".name" set for in-memory uploads. + video_start_ts (``float``, *optional*): + The timestamp in seconds of the video frame to use as photo profile preview. + Returns: ``bool``: True on success. @@ -82,7 +86,8 @@ class SetChatPhoto(Scaffold): if os.path.isfile(photo): photo = raw.types.InputChatUploadedPhoto( file=await self.save_file(photo), - video=await self.save_file(video) + video=await self.save_file(video), + video_start_ts=video_start_ts, ) else: photo = utils.get_input_media_from_file_id(photo, FileType.PHOTO) @@ -90,14 +95,15 @@ class SetChatPhoto(Scaffold): else: photo = raw.types.InputChatUploadedPhoto( file=await self.save_file(photo), - video=await self.save_file(video) + video=await self.save_file(video), + video_start_ts=video_start_ts, ) if isinstance(peer, raw.types.InputPeerChat): await self.send( raw.functions.messages.EditChatPhoto( chat_id=peer.chat_id, - photo=photo + photo=photo, ) ) elif isinstance(peer, raw.types.InputPeerChannel):