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]>
  • Loading branch information
2 people authored and wulan17 committed Sep 25, 2024
1 parent 2d83118 commit c3df58b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pyrogram/methods/messages/send_sticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,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 @@ -183,7 +187,11 @@ 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):
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 @@ -3173,6 +3173,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 @@ -3218,6 +3219,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 @@ -3305,6 +3309,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

1 comment on commit c3df58b

@SpEcHiDe
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, there is a small bug in this 🥺😥😥

Please sign in to comment.