@@ -31,7 +31,8 @@ async def set_chat_photo(
3131 chat_id : Union [int , str ],
3232 * ,
3333 photo : Union [str , BinaryIO ] = None ,
34- video : Union [str , BinaryIO ] = None
34+ video : Union [str , BinaryIO ] = None ,
35+ video_start_ts : float = None ,
3536 ) -> bool :
3637 """Set a new chat photo or video (H.264/MPEG-4 AVC video, max 5 seconds).
3738
@@ -54,6 +55,9 @@ async def set_chat_photo(
5455 from your local machine or a binary file-like object with its attribute
5556 ".name" set for in-memory uploads.
5657
58+ video_start_ts (``float``, *optional*):
59+ The timestamp in seconds of the video frame to use as photo profile preview.
60+
5761 Returns:
5862 ``bool``: True on success.
5963
@@ -82,22 +86,24 @@ async def set_chat_photo(
8286 if os .path .isfile (photo ):
8387 photo = raw .types .InputChatUploadedPhoto (
8488 file = await self .save_file (photo ),
85- video = await self .save_file (video )
89+ video = await self .save_file (video ),
90+ video_start_ts = video_start_ts ,
8691 )
8792 else :
8893 photo = utils .get_input_media_from_file_id (photo , FileType .PHOTO )
8994 photo = raw .types .InputChatPhoto (id = photo .id )
9095 else :
9196 photo = raw .types .InputChatUploadedPhoto (
9297 file = await self .save_file (photo ),
93- video = await self .save_file (video )
98+ video = await self .save_file (video ),
99+ video_start_ts = video_start_ts ,
94100 )
95101
96102 if isinstance (peer , raw .types .InputPeerChat ):
97103 await self .send (
98104 raw .functions .messages .EditChatPhoto (
99105 chat_id = peer .chat_id ,
100- photo = photo
106+ photo = photo ,
101107 )
102108 )
103109 elif isinstance (peer , raw .types .InputPeerChannel ):
0 commit comments