From 3351e00cdcc9cb3084d4015ff9cef641cd4483f4 Mon Sep 17 00:00:00 2001 From: KurimuzonAkuma Date: Tue, 27 Aug 2024 11:45:50 +0300 Subject: [PATCH] Add business_connection_id parameter to send_paid_media method --- pyrogram/methods/messages/send_media_group.py | 7 ++++--- pyrogram/methods/messages/send_paid_media.py | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/pyrogram/methods/messages/send_media_group.py b/pyrogram/methods/messages/send_media_group.py index 70149344..00b3cd6b 100644 --- a/pyrogram/methods/messages/send_media_group.py +++ b/pyrogram/methods/messages/send_media_group.py @@ -477,9 +477,10 @@ class SendMediaGroup: conn_id = None - for i in r.updates: - if getattr(i, "connection_id", None): - conn_id = i.connection_id + for u in r.updates: + if getattr(u, "connection_id", None): + conn_id = u.connection_id + break return await utils.parse_messages( diff --git a/pyrogram/methods/messages/send_paid_media.py b/pyrogram/methods/messages/send_paid_media.py index ea6b9165..af2b6eab 100644 --- a/pyrogram/methods/messages/send_paid_media.py +++ b/pyrogram/methods/messages/send_paid_media.py @@ -51,7 +51,8 @@ class SendPaidMedia: quote_offset: int = None, schedule_date: datetime = None, protect_content: bool = None, - show_above_text: bool = None + show_above_text: bool = None, + business_connection_id: str = None ) -> List["types.Message"]: """Send a group or one paid photo/video. @@ -106,6 +107,9 @@ class SendPaidMedia: If True, link preview will be shown above the message text. Otherwise, the link preview will be shown below the message text. + business_connection_id (``str``, *optional*): + Unique identifier of the business connection on behalf of which the message will be sent. + Returns: :obj:`~pyrogram.types.Message`: On success, the sent message is returned. @@ -264,8 +268,16 @@ class SendPaidMedia: **await utils.parse_text_entities(self, caption, parse_mode, caption_entities) ), sleep_threshold=60, + business_connection_id=business_connection_id ) + conn_id = None + + for u in r.updates: + if getattr(u, "connection_id", None): + conn_id = u.connection_id + break + return await utils.parse_messages( self, raw.types.messages.Messages( @@ -279,4 +291,5 @@ class SendPaidMedia: users=r.users, chats=r.chats ), + business_connection_id=conn_id )