Add emoji to send_sticker and reply_sticker.

KurimuzonAkuma/pyrogram#86

Co-authored-by: Surendra9123 <Surendra9123@users.noreply.github.com>
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
Shrimadhav U K 2024-09-10 13:07:59 +05:30 committed by wulan17
parent 2d83118f0f
commit c3df58b4c7
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5
2 changed files with 14 additions and 1 deletions

View file

@ -37,6 +37,7 @@ class SendSticker:
self: "pyrogram.Client",
chat_id: Union[int, str],
sticker: Union[str, BinaryIO],
emoji: str = None,
disable_notification: bool = None,
message_thread_id: int = None,
business_connection_id: str = None,
@ -76,6 +77,9 @@ class SendSticker:
pass a file path as string to upload a new sticker that exists on your local machine, or
pass a binary file-like object with its attribute ".name" set for in-memory uploads.
emoji (``str``, *optional*):
Emoji associated with the sticker; only for just uploaded stickers
disable_notification (``bool``, *optional*):
Sends the message silently.
Users will receive a notification with no sound.
@ -183,7 +187,11 @@ class SendSticker:
mime_type=self.guess_mime_type(sticker) or "image/webp",
file=file,
attributes=[
raw.types.DocumentAttributeFilename(file_name=os.path.basename(sticker))
raw.types.DocumentAttributeFilename(file_name=os.path.basename(sticker)),
raw.types.DocumentAttributeSticker(
alt=emoji,
stickerset=raw.types.InputStickerSetEmpty()
)
]
)
elif re.match("^https?://", sticker):

View file

@ -3173,6 +3173,7 @@ class Message(Object, Update):
self,
sticker: Union[str, BinaryIO],
quote: bool = None,
emoji: str = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
business_connection_id: str = None,
@ -3218,6 +3219,9 @@ class Message(Object, Update):
If *reply_to_message_id* is passed, this parameter will be ignored.
Defaults to ``True`` in group chats and ``False`` in private chats.
emoji (``str``, *optional*):
Emoji associated with the sticker; only for just uploaded stickers
disable_notification (``bool``, *optional*):
Sends the message silently.
Users will receive a notification with no sound.
@ -3305,6 +3309,7 @@ class Message(Object, Update):
return await self._client.send_sticker(
chat_id=chat_id,
sticker=sticker,
emoji=emoji,
disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,