Skip to content

Commit

Permalink
pyrofork: Add emoji and emoji_background parameters to Chat.set_photo…
Browse files Browse the repository at this point in the history
… bound method

Signed-off-by: wulan17 <wulan17@nusantararom.org>
  • Loading branch information
wulan17 committed Sep 7, 2024
1 parent 3bc671e commit 4d941eb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pyrogram/types/user_and_chats/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,8 @@ async def set_photo(
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:
Expand All @@ -793,6 +795,11 @@ async def set_photo(
# 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 photo with emoji and emoji_background
await chat.set_photo(photo="photo.jpg", emoji=5366316836101038579, emoji_background=[0, 0, 0, 0])
# Set chat video using a local file
await chat.set_photo(video="video.mp4")
Expand All @@ -806,6 +813,12 @@ async def set_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
from your local machine or a binary file-like object with its attribute
Expand All @@ -825,6 +838,8 @@ async def set_photo(
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
)
Expand Down

0 comments on commit 4d941eb

Please sign in to comment.