mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-24 15:59:18 +00:00
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:
parent
3e79d7dfce
commit
f1298dfdc6
@ -31,7 +31,8 @@ class SetChatPhoto(Scaffold):
|
|||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
*,
|
*,
|
||||||
photo: Union[str, BinaryIO] = None,
|
photo: Union[str, BinaryIO] = None,
|
||||||
video: Union[str, BinaryIO] = None
|
video: Union[str, BinaryIO] = None,
|
||||||
|
video_start_ts: float = None,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Set a new chat photo or video (H.264/MPEG-4 AVC video, max 5 seconds).
|
"""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
|
from your local machine or a binary file-like object with its attribute
|
||||||
".name" set for in-memory uploads.
|
".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:
|
Returns:
|
||||||
``bool``: True on success.
|
``bool``: True on success.
|
||||||
|
|
||||||
@ -82,7 +86,8 @@ class SetChatPhoto(Scaffold):
|
|||||||
if os.path.isfile(photo):
|
if os.path.isfile(photo):
|
||||||
photo = raw.types.InputChatUploadedPhoto(
|
photo = raw.types.InputChatUploadedPhoto(
|
||||||
file=await self.save_file(photo),
|
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:
|
else:
|
||||||
photo = utils.get_input_media_from_file_id(photo, FileType.PHOTO)
|
photo = utils.get_input_media_from_file_id(photo, FileType.PHOTO)
|
||||||
@ -90,14 +95,15 @@ class SetChatPhoto(Scaffold):
|
|||||||
else:
|
else:
|
||||||
photo = raw.types.InputChatUploadedPhoto(
|
photo = raw.types.InputChatUploadedPhoto(
|
||||||
file=await self.save_file(photo),
|
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):
|
if isinstance(peer, raw.types.InputPeerChat):
|
||||||
await self.send(
|
await self.send(
|
||||||
raw.functions.messages.EditChatPhoto(
|
raw.functions.messages.EditChatPhoto(
|
||||||
chat_id=peer.chat_id,
|
chat_id=peer.chat_id,
|
||||||
photo=photo
|
photo=photo,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif isinstance(peer, raw.types.InputPeerChannel):
|
elif isinstance(peer, raw.types.InputPeerChannel):
|
||||||
|
Loading…
Reference in New Issue
Block a user