diff --git a/pyrogram/methods/users/set_profile_photo.py b/pyrogram/methods/users/set_profile_photo.py index 8094bf18..4276abe8 100644 --- a/pyrogram/methods/users/set_profile_photo.py +++ b/pyrogram/methods/users/set_profile_photo.py @@ -28,6 +28,8 @@ class SetProfilePhoto: self: "pyrogram.Client", *, photo: Union[str, BinaryIO] = None, + emoji: int = None, + emoji_background: Union[int, list[int]] = None, video: Union[str, BinaryIO] = None ) -> bool: """Set a new profile photo or video (H.264/MPEG-4 AVC video, max 5 seconds). @@ -48,6 +50,12 @@ class SetProfilePhoto: Pass a file path as string to upload a new photo that exists on your local machine or pass 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 profile photo. + + emoji_background (``int`` | ``List[int]``, *optional*): + hexadecimal colors or List of hexadecimal colors to be used as the chat photo background. + video (``str`` | ``BinaryIO``, *optional*): Profile video to set. Pass a file path as string to upload a new video that exists on your local machine or @@ -66,10 +74,21 @@ class SetProfilePhoto: await app.set_profile_photo(video="new_video.mp4") """ + emoji_id = None + if emoji: + background_colors = emoji_background if emoji_background is not None else [0xFFFFFF] + if isinstance(background_colors, int): + background_colors = [background_colors] + emoji_id = raw.types.VideoSizeEmojiMarkup( + emoji_id=emoji, + background_colors=background_colors + ) + return bool( await self.invoke( raw.functions.photos.UploadProfilePhoto( file=await self.save_file(photo), + video_emoji_markup=emoji_id, video=await self.save_file(video) ) )