Add bound method Message.react (#937)

* Bound method `react` to send reaction

* Update message.py

* Update message.py

* Update compiler.py

Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com>
This commit is contained in:
Krishna-singhal 2022-03-29 00:33:37 +05:30 committed by GitHub
parent e50b58980a
commit 0825b977ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 0 deletions

View File

@ -518,6 +518,7 @@ def pyrogram_api():
Message.reply_video_note
Message.reply_voice
Message.get_media_group
Message.react
""",
chat="""
Chat

View File

@ -3286,6 +3286,42 @@ class Message(Object, Update):
else:
await self.reply(button, quote=quote)
async def react(self, emoji: str = "") -> bool:
"""Bound method *react* of :obj:`~pyrogram.types.Message`.
Use as a shortcut for:
.. code-block:: python
client.send_reaction(
chat_id=chat_id,
message_id=message.message_id,
emoji="🔥"
)
Example:
.. code-block:: python
message.react(emoji="🔥")
Parameters:
emoji (``str``, *optional*):
Reaction emoji.
Pass "" as emoji (default) to retract the reaction.
Returns:
``bool``: On success, True is returned.
Raises:
RPCError: In case of a Telegram RPC error.
"""
return await self._client.send_reaction(
chat_id=self.chat.id,
message_id=self.message_id,
emoji=emoji
)
async def retract_vote(
self,
) -> "types.Poll":