From f84e1f6a5e76db92602e556444b90a75258dcc72 Mon Sep 17 00:00:00 2001 From: shriMADhav U k Date: Sun, 21 Apr 2024 18:17:18 +0200 Subject: [PATCH] pyrofork: add ability to specify our own interactions in send_chat_action Signed-off-by: wulan17 --- pyrogram/methods/messages/send_chat_action.py | 22 ++++++++++++------- pyrogram/types/messages_and_media/message.py | 9 ++++++-- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/pyrogram/methods/messages/send_chat_action.py b/pyrogram/methods/messages/send_chat_action.py index 8f8d7677..9b170294 100644 --- a/pyrogram/methods/messages/send_chat_action.py +++ b/pyrogram/methods/messages/send_chat_action.py @@ -33,7 +33,8 @@ class SendChatAction: message_thread_id: int = None, business_connection_id: str = None, emoji: str = None, - emoji_message_id: int = None + emoji_message_id: int = None, + emoji_message_interaction: "raw.types.DataJSON" = None ) -> bool: """Tell the other party that something is happening on your side. @@ -63,6 +64,9 @@ class SendChatAction: emoji_message_id (``int``, *optional*): Message identifier of the message containing the animated emoji. Only supported for :obj:`~pyrogram.enums.ChatAction.TRIGGER_EMOJI_ANIMATION`. + emoji_message_interaction (:obj:`raw.types.DataJSON`, *optional*): + Only supported for :obj:`~pyrogram.enums.ChatAction.TRIGGER_EMOJI_ANIMATION`. + Returns: ``bool``: On success, True is returned. @@ -105,13 +109,11 @@ class SendChatAction: raise ValueError( "Invalid Argument Provided" ) - _, sticker_set = await self._get_raw_stickers( - raw.types.InputStickerSetAnimatedEmojiAnimations() - ) - action = action.value( - emoticon=emoji, - msg_id=emoji_message_id, - interaction=raw.types.DataJSON( + if emoji_message_interaction is None: + _, sticker_set = await self._get_raw_stickers( + raw.types.InputStickerSetAnimatedEmojiAnimations() + ) + emoji_message_interaction = raw.types.DataJSON( data=dumps( { "v": 1, @@ -127,6 +129,10 @@ class SendChatAction: } ) ) + action = action.value( + emoticon=emoji, + msg_id=emoji_message_id, + interaction=emoji_message_interaction ) else: action = action.value() diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index f282f7c6..b1b3439d 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -1891,7 +1891,8 @@ class Message(Object, Update): action: "enums.ChatAction", business_connection_id: str = None, emoji: str = None, - emoji_message_id: int = None + emoji_message_id: int = None, + emoji_message_interaction: "raw.types.DataJSON" = None ) -> bool: """Bound method *reply_chat_action* of :obj:`~pyrogram.types.Message`. @@ -1927,6 +1928,9 @@ class Message(Object, Update): emoji_message_id (``int``, *optional*): Message identifier of the message containing the animated emoji. Only supported for :obj:`~pyrogram.enums.ChatAction.TRIGGER_EMOJI_ANIMATION`. + emoji_message_interaction (:obj:`raw.types.DataJSON`, *optional*): + Only supported for :obj:`~pyrogram.enums.ChatAction.TRIGGER_EMOJI_ANIMATION`. + Returns: ``bool``: On success, True is returned. @@ -1942,7 +1946,8 @@ class Message(Object, Update): business_connection_id=business_connection_id, action=action, emoji=emoji, - emoji_message_id=emoji_message_id + emoji_message_id=emoji_message_id, + emoji_message_interaction=emoji_message_interaction ) async def reply_contact(