Add business_connection_id parameter to send_paid_media method

This commit is contained in:
KurimuzonAkuma 2024-08-27 11:45:50 +03:00
parent 00d1b532b8
commit 3351e00cdc
2 changed files with 18 additions and 4 deletions

View File

@ -477,9 +477,10 @@ class SendMediaGroup:
conn_id = None conn_id = None
for i in r.updates: for u in r.updates:
if getattr(i, "connection_id", None): if getattr(u, "connection_id", None):
conn_id = i.connection_id conn_id = u.connection_id
break
return await utils.parse_messages( return await utils.parse_messages(

View File

@ -51,7 +51,8 @@ class SendPaidMedia:
quote_offset: int = None, quote_offset: int = None,
schedule_date: datetime = None, schedule_date: datetime = None,
protect_content: bool = None, protect_content: bool = None,
show_above_text: bool = None show_above_text: bool = None,
business_connection_id: str = None
) -> List["types.Message"]: ) -> List["types.Message"]:
"""Send a group or one paid photo/video. """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. If True, link preview will be shown above the message text.
Otherwise, the link preview will be shown below 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: Returns:
:obj:`~pyrogram.types.Message`: On success, the sent message is returned. :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) **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
), ),
sleep_threshold=60, 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( return await utils.parse_messages(
self, self,
raw.types.messages.Messages( raw.types.messages.Messages(
@ -279,4 +291,5 @@ class SendPaidMedia:
users=r.users, users=r.users,
chats=r.chats chats=r.chats
), ),
business_connection_id=conn_id
) )