From c2cd506be9c989f9c7e22e46d1c131b5b43b09db Mon Sep 17 00:00:00 2001 From: wulan17 Date: Sat, 7 Sep 2024 19:04:03 +0700 Subject: [PATCH] pyrofork: Add emoji and emoji_background parameters to Chat.set_photo bound method Signed-off-by: wulan17 --- pyrogram/types/user_and_chats/chat.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/pyrogram/types/user_and_chats/chat.py b/pyrogram/types/user_and_chats/chat.py index bf333715..35d819e9 100644 --- a/pyrogram/types/user_and_chats/chat.py +++ b/pyrogram/types/user_and_chats/chat.py @@ -770,6 +770,8 @@ class Chat(Object): self, *, photo: Union[str, BinaryIO] = None, + emoji: int = None, + emoji_background: Union[int, List[int]] = None, video: Union[str, BinaryIO] = None, video_start_ts: float = None, ) -> bool: @@ -793,21 +795,29 @@ class Chat(Object): # Set chat photo using an existing Photo file_id await chat.set_photo(photo=photo.file_id) + # set chat photo with emoji + await chat.set_photo(photo="photo.jpg", emoji=5366316836101038579) - # Set chat video using a local file + # set chat photo with emoji and emoji_background + await chat.set_photo(photo="photo.jpg", emoji=5366316836101038579, emoji_background=[0, 0, 0, 0]) + + # Set chat video await chat.set_photo(video="video.mp4") - # Set chat photo using an existing Video file_id - await chat.set_photo(video=video.file_id) - Parameters: photo (``str`` | ``BinaryIO``, *optional*): New chat photo. You can pass a :obj:`~pyrogram.types.Photo` file_id, a file path to upload a new photo from your local machine or a binary file-like object with its attribute ".name" set for in-memory uploads. + emoji (``int``, *optional*): + Unique identifier (int) of the emoji to be used as the chat photo. + + emoji_background (``int`` | List of ``int``, *optional*): + hexadecimal colors or List of hexadecimal colors to be used as the chat photo background. + video (``str`` | ``BinaryIO``, *optional*): - New chat video. You can pass a :obj:`~pyrogram.types.Video` file_id, a file path to upload a new video + New chat video. You can pass a file path to upload a new video from your local machine or a binary file-like object with its attribute ".name" set for in-memory uploads. @@ -825,6 +835,8 @@ class Chat(Object): return await self._client.set_chat_photo( chat_id=self.id, photo=photo, + emoji=emoji, + emoji_background=emoji_background, video=video, video_start_ts=video_start_ts )