1717# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818
1919from datetime import datetime
20- from typing import Union , List , Optional , AsyncGenerator
20+ from typing import Union , List , Optional , AsyncGenerator , BinaryIO
2121
2222import pyrogram
2323from pyrogram import raw , enums
@@ -477,7 +477,13 @@ async def set_description(self, description: str) -> bool:
477477 description = description
478478 )
479479
480- async def set_photo (self , photo : str ) -> bool :
480+ async def set_photo (
481+ self ,
482+ * ,
483+ photo : Union [str , BinaryIO ] = None ,
484+ video : Union [str , BinaryIO ] = None ,
485+ video_start_ts : float = None ,
486+ ) -> bool :
481487 """Bound method *set_photo* of :obj:`~pyrogram.types.Chat`.
482488
483489 Use as a shortcut for:
@@ -492,11 +498,32 @@ async def set_photo(self, photo: str) -> bool:
492498 Example:
493499 .. code-block:: python
494500
495- await chat.set_photo("photo.png")
501+ # Set chat photo using a local file
502+ await chat.set_photo(photo="photo.jpg")
503+
504+ # Set chat photo using an existing Photo file_id
505+ await chat.set_photo(photo=photo.file_id)
506+
507+
508+ # Set chat video using a local file
509+ await chat.set_photo(video="video.mp4")
510+
511+ # Set chat photo using an existing Video file_id
512+ await chat.set_photo(video=video.file_id)
496513
497514 Parameters:
498- photo (``str``):
499- New chat photo. You can pass a :obj:`~pyrogram.types.Photo` id or a file path to upload a new photo.
515+ photo (``str`` | ``BinaryIO``, *optional*):
516+ New chat photo. You can pass a :obj:`~pyrogram.types.Photo` file_id, a file path to upload a new photo
517+ from your local machine or a binary file-like object with its attribute
518+ ".name" set for in-memory uploads.
519+
520+ video (``str`` | ``BinaryIO``, *optional*):
521+ New chat video. You can pass a :obj:`~pyrogram.types.Video` file_id, a file path to upload a new video
522+ from your local machine or a binary file-like object with its attribute
523+ ".name" set for in-memory uploads.
524+
525+ video_start_ts (``float``, *optional*):
526+ The timestamp in seconds of the video frame to use as photo profile preview.
500527
501528 Returns:
502529 ``bool``: True on success.
@@ -508,7 +535,9 @@ async def set_photo(self, photo: str) -> bool:
508535
509536 return await self ._client .set_chat_photo (
510537 chat_id = self .id ,
511- photo = photo
538+ photo = photo ,
539+ video = video ,
540+ video_start_ts = video_start_ts
512541 )
513542
514543 async def ban_member (
0 commit comments