mirror of
https://github.com/pyrogram/pyrogram
synced 2025-09-02 15:25:41 +00:00
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:
@@ -518,6 +518,7 @@ def pyrogram_api():
|
|||||||
Message.reply_video_note
|
Message.reply_video_note
|
||||||
Message.reply_voice
|
Message.reply_voice
|
||||||
Message.get_media_group
|
Message.get_media_group
|
||||||
|
Message.react
|
||||||
""",
|
""",
|
||||||
chat="""
|
chat="""
|
||||||
Chat
|
Chat
|
||||||
|
@@ -3286,6 +3286,42 @@ class Message(Object, Update):
|
|||||||
else:
|
else:
|
||||||
await self.reply(button, quote=quote)
|
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(
|
async def retract_vote(
|
||||||
self,
|
self,
|
||||||
) -> "types.Poll":
|
) -> "types.Poll":
|
||||||
|
Reference in New Issue
Block a user