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>
This commit is contained in:
Roj 2022-01-29 16:08:15 +03:00 committed by GitHub
parent 3e79d7dfce
commit f1298dfdc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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):