Skip to content

Commit

Permalink
Add emoji to send_sticker and reply_sticker.
Browse files Browse the repository at this point in the history
KurimuzonAkuma/pyrogram#86

Co-authored-by: Surendra9123 <[email protected]>
Signed-off-by: wulan17 <[email protected]>

(cherry picked from commit c3df58b)
Signed-off-by: eyMarv <[email protected]>
  • Loading branch information
2 people authored and eyMarv committed Sep 28, 2024
1 parent 5bc7100 commit 29c4e33
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pyrogram/methods/messages/send_sticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ async def send_sticker(
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,
Expand Down Expand Up @@ -76,6 +77,9 @@ async def send_sticker(
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.
Expand Down Expand Up @@ -182,10 +186,12 @@ async def send_sticker(
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):
media = raw.types.InputMediaDocumentExternal(url=sticker)
Expand Down
5 changes: 5 additions & 0 deletions pyrogram/types/messages_and_media/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -3306,6 +3306,7 @@ async def reply_sticker(
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,
Expand Down Expand Up @@ -3350,6 +3351,9 @@ async def reply_sticker(
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.
Expand Down Expand Up @@ -3434,6 +3438,7 @@ async def reply_sticker(
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,
Expand Down

0 comments on commit 29c4e33

Please sign in to comment.