mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-08 16:04:51 +00:00
pyrofork: Add emoji and emoji_background parameters to set_profile_photo method
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
c2cd506be9
commit
f7e1f214c6
1 changed files with 19 additions and 0 deletions
|
|
@ -28,6 +28,8 @@ class SetProfilePhoto:
|
||||||
self: "pyrogram.Client",
|
self: "pyrogram.Client",
|
||||||
*,
|
*,
|
||||||
photo: Union[str, BinaryIO] = None,
|
photo: Union[str, BinaryIO] = None,
|
||||||
|
emoji: int = None,
|
||||||
|
emoji_background: Union[int, list[int]] = None,
|
||||||
video: Union[str, BinaryIO] = None
|
video: Union[str, BinaryIO] = None
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Set a new profile photo or video (H.264/MPEG-4 AVC video, max 5 seconds).
|
"""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 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.
|
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*):
|
video (``str`` | ``BinaryIO``, *optional*):
|
||||||
Profile video to set.
|
Profile video to set.
|
||||||
Pass a file path as string to upload a new video that exists on your local machine or
|
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")
|
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(
|
return bool(
|
||||||
await self.invoke(
|
await self.invoke(
|
||||||
raw.functions.photos.UploadProfilePhoto(
|
raw.functions.photos.UploadProfilePhoto(
|
||||||
file=await self.save_file(photo),
|
file=await self.save_file(photo),
|
||||||
|
video_emoji_markup=emoji_id,
|
||||||
video=await self.save_file(video)
|
video=await self.save_file(video)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue