diff --git a/pyrogram/methods/messages/edit_message_caption.py b/pyrogram/methods/messages/edit_message_caption.py index c7b7a7865..0aad7efea 100644 --- a/pyrogram/methods/messages/edit_message_caption.py +++ b/pyrogram/methods/messages/edit_message_caption.py @@ -29,6 +29,7 @@ async def edit_message_caption( chat_id: Union[int, str], message_id: int, caption: str, + business_connection_id: str = None, parse_mode: Optional["enums.ParseMode"] = None, caption_entities: List["types.MessageEntity"] = None, reply_markup: "types.InlineKeyboardMarkup" = None @@ -50,6 +51,10 @@ async def edit_message_caption( caption (``str``): New caption of the media message. + business_connection_id (``str``, *optional*): + Business connection identifier. + for business bots only. + parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*): By default, texts are parsed using both Markdown and HTML styles. You can combine both syntaxes together. @@ -72,6 +77,7 @@ async def edit_message_caption( chat_id=chat_id, message_id=message_id, text=caption, + business_connection_id=business_connection_id, parse_mode=parse_mode, entities=caption_entities, reply_markup=reply_markup diff --git a/pyrogram/methods/messages/edit_message_text.py b/pyrogram/methods/messages/edit_message_text.py index 6d320c9e5..fdaf13c02 100644 --- a/pyrogram/methods/messages/edit_message_text.py +++ b/pyrogram/methods/messages/edit_message_text.py @@ -31,6 +31,7 @@ async def edit_message_text( chat_id: Union[int, str], message_id: int, text: str, + business_connection_id: str = None, parse_mode: Optional["enums.ParseMode"] = None, entities: List["types.MessageEntity"] = None, disable_web_page_preview: bool = None, @@ -53,6 +54,10 @@ async def edit_message_text( text (``str``): New text of the message. + business_connection_id (``str``, *optional*): + Business connection identifier. + for business bots only. + parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*): By default, texts are parsed using both Markdown and HTML styles. You can combine both syntaxes together. @@ -81,15 +86,22 @@ async def edit_message_text( disable_web_page_preview=True) """ - r = await self.invoke( - raw.functions.messages.EditMessage( - peer=await self.resolve_peer(chat_id), - id=message_id, - no_webpage=disable_web_page_preview or None, - reply_markup=await reply_markup.write(self) if reply_markup else None, - **await utils.parse_text_entities(self, text, parse_mode, entities) - ) + rpc = raw.functions.messages.EditMessage( + peer=await self.resolve_peer(chat_id), + id=message_id, + no_webpage=disable_web_page_preview or None, + reply_markup=await reply_markup.write(self) if reply_markup else None, + **await utils.parse_text_entities(self, text, parse_mode, entities) ) + if business_connection_id: + r = await self.invoke( + raw.functions.InvokeWithBusinessConnection( + connection_id=business_connection_id, + query=rpc + ) + ) + else: + r = await self.invoke(rpc) for i in r.updates: if isinstance(i, (raw.types.UpdateEditMessage, raw.types.UpdateEditChannelMessage)):