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#86

Co-authored-by: Surendra9123 <[email protected]>
  • Loading branch information
SpEcHiDe and Surendra9123 authored Sep 10, 2024
1 parent 1bc3233 commit 0835877
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/source/releases/changes-in-this-fork.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ If you found any issue or have any suggestions, feel free to make `an issue <htt
| Scheme layer used: 187 |
+------------------------+

- Added the parameter ``emoji`` in :meth:`~pyrogram.Client.send_sticker` and :meth:`~pyrogram.types.Message.reply_sticker`. `#86 <https://github.com/KurimuzonAkuma/pyrogram/pull/86>`__.

- Added the field ``prize_star_count`` to the classes :obj:`~pyrogram.types.GiveawayCreated`, :obj:`~pyrogram.types.Giveaway`, :obj:`~pyrogram.types.GiveawayWinners`.
- Added the field ``is_star_giveaway`` to the class :obj:`~pyrogram.types.GiveawayCompleted`.
- Added the ability to specify a payload in :meth:`~pyrogram.Client.send_paid_media` that is unused currently.
Expand Down
14 changes: 11 additions & 3 deletions pyrogram/methods/messages/send_sticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def send_sticker(
caption: str = "",
parse_mode: Optional["enums.ParseMode"] = None,
caption_entities: List["types.MessageEntity"] = None,
# emoji: str = None,
emoji: str = None,
disable_notification: bool = None,
protect_content: bool = None,
message_thread_id: int = None,
Expand All @@ -52,8 +52,8 @@ async def send_sticker(
"types.ReplyKeyboardRemove",
"types.ForceReply"
] = None,
reply_to_message_id: int = None,
schedule_date: datetime = None,
reply_to_message_id: int = None,
progress: Callable = None,
progress_args: tuple = ()
) -> Optional["types.Message"]:
Expand Down Expand Up @@ -84,7 +84,7 @@ async def send_sticker(
caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
emoji (``str``, *optional*): // UNUSED CURRENTLY
emoji (``str``, *optional*):
Emoji associated with the sticker; only for just uploaded stickers
disable_notification (``bool``, *optional*):
Expand Down Expand Up @@ -174,6 +174,10 @@ async def send_sticker(
file=file,
attributes=[
raw.types.DocumentAttributeFilename(file_name=os.path.basename(sticker)),
raw.types.DocumentAttributeSticker(
alt=emoji,
stickerset=raw.types.InputStickerSetEmpty()
),
]
)
elif re.match("^https?://", sticker):
Expand All @@ -189,6 +193,10 @@ async def send_sticker(
file=file,
attributes=[
raw.types.DocumentAttributeFilename(file_name=sticker.name),
raw.types.DocumentAttributeSticker(
alt=emoji,
stickerset=raw.types.InputStickerSetEmpty()
),
]
)

Expand Down
21 changes: 21 additions & 0 deletions pyrogram/types/messages_and_media/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -2983,6 +2983,10 @@ async def reply_sticker(
self,
sticker: Union[str, BinaryIO],
quote: bool = None,
caption: str = "",
parse_mode: Optional["enums.ParseMode"] = None,
caption_entities: List["types.MessageEntity"] = None,
emoji: str = None,
disable_notification: bool = None,
protect_content: bool = None,
message_effect_id: int = None,
Expand Down Expand Up @@ -3026,6 +3030,19 @@ 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.
caption (``str``, *optional*):
Photo caption, 0-1024 characters.
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
By default, texts are parsed using both Markdown and HTML styles.
You can combine both syntaxes together.
caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
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 @@ -3087,6 +3104,10 @@ async def reply_sticker(
return await self._client.send_sticker(
chat_id=self.chat.id,
sticker=sticker,
caption=caption,
parse_mode=parse_mode,
caption_entities=caption_entities,
emoji=emoji,
disable_notification=disable_notification,
protect_content=protect_content,
message_thread_id=self.message_thread_id,
Expand Down

0 comments on commit 0835877

Please sign in to comment.