Pyrofork: Add business_connection_id parameter to Message.reply_{animation,audio,chat_action,contact,dice,document,game,location,media_group,message,photo,poll,sticker,venue,video,video_note,voice,web_page} bound methods

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
wulan17 2024-04-06 21:06:07 +07:00
parent f0a4bce5a5
commit d624f386c1
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5

View file

@ -1241,6 +1241,7 @@ class Message(Object, Update):
disable_web_page_preview: bool = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
business_connection_id: str = None,
reply_in_chat_id: Union[int, str] = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
@ -1294,6 +1295,10 @@ class Message(Object, Update):
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message.
business_connection_id (``str``, *optional*):
Business connection identifier.
for business bots only.
reply_to_chat_id (``int`` | ``str``, *optional*):
Unique identifier for the origin chat.
for reply to message from another chat.
@ -1337,6 +1342,9 @@ class Message(Object, Update):
if self.message_thread_id:
message_thread_id = self.message_thread_id
if business_connection_id is None and self.business_connection_id:
business_connection_id = self.business_connection_id
chat_id = self.chat.id
reply_to_chat_id = None
if reply_in_chat_id is not None:
@ -1352,6 +1360,7 @@ class Message(Object, Update):
disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,
business_connection_id=business_connection_id,
reply_to_chat_id=reply_to_chat_id,
quote_text=quote_text,
quote_entities=quote_entities,
@ -1384,6 +1393,7 @@ class Message(Object, Update):
"types.ForceReply"
] = None,
reply_to_message_id: int = None,
business_connection_id: str = None,
reply_in_chat_id: Union[int, str] = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
@ -1457,6 +1467,10 @@ class Message(Object, Update):
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message.
business_connection_id (``str``, *optional*):
Business connection identifier.
for business bots only.
reply_to_chat_id (``int`` | ``str``, *optional*):
Unique identifier for the origin chat.
for reply to message from another chat.
@ -1514,6 +1528,9 @@ class Message(Object, Update):
if self.message_thread_id:
message_thread_id = self.message_thread_id
if business_connection_id is None and self.business_connection_id:
business_connection_id = self.business_connection_id
chat_id = self.chat.id
reply_to_chat_id = None
if reply_in_chat_id is not None:
@ -1535,6 +1552,7 @@ class Message(Object, Update):
disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,
business_connection_id=business_connection_id,
reply_to_chat_id=reply_to_chat_id,
quote_text=quote_text,
quote_entities=quote_entities,
@ -1557,6 +1575,7 @@ class Message(Object, Update):
file_name: str = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
business_connection_id: str = None,
reply_in_chat_id: Union[int, str] = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
@ -1633,6 +1652,10 @@ class Message(Object, Update):
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message.
business_connection_id (``str``, *optional*):
Business connection identifier.
for business bots only.
reply_in_chat_id: Union[int, str] = None,
Unique identifier of target chat.
for reply message in another chat.
@ -1689,6 +1712,9 @@ class Message(Object, Update):
if self.message_thread_id:
message_thread_id = self.message_thread_id
if business_connection_id is None and self.business_connection_id:
business_connection_id = self.business_connection_id
chat_id = self.chat.id
reply_to_chat_id = None
if reply_in_chat_id is not None:
@ -1709,6 +1735,7 @@ class Message(Object, Update):
disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,
business_connection_id=business_connection_id,
reply_to_chat_id=reply_to_chat_id,
quote_text=quote_text,
quote_entities=quote_entities,
@ -1832,7 +1859,11 @@ class Message(Object, Update):
reply_markup=reply_markup
)
async def reply_chat_action(self, action: "enums.ChatAction") -> bool:
async def reply_chat_action(
self,
action: "enums.ChatAction",
business_connection_id: str = None
) -> bool:
"""Bound method *reply_chat_action* of :obj:`~pyrogram.types.Message`.
Use as a shortcut for:
@ -1857,6 +1888,10 @@ class Message(Object, Update):
action (:obj:`~pyrogram.enums.ChatAction`):
Type of action to broadcast.
business_connection_id (``str``, *optional*):
Business connection identifier.
for business bots only.
Returns:
``bool``: On success, True is returned.
@ -1864,8 +1899,12 @@ class Message(Object, Update):
RPCError: In case of a Telegram RPC error.
ValueError: In case the provided string is not a valid chat action.
"""
if business_connection_id is None and self.business_connection_id:
business_connection_id = self.business_connection_id
return await self._client.send_chat_action(
chat_id=self.chat.id,
business_connection_id=business_connection_id,
action=action
)
@ -1878,6 +1917,7 @@ class Message(Object, Update):
vcard: str = "",
disable_notification: bool = None,
reply_to_message_id: int = None,
business_connection_id: str = None,
reply_in_chat_id: Union[int, str] = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
@ -1931,6 +1971,10 @@ class Message(Object, Update):
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message.
business_connection_id (``str``, *optional*):
Business connection identifier.
for business bots only.
reply_in_chat_id: Union[int, str] = None,
Unique identifier of target chat.
for reply message in another chat.
@ -1968,6 +2012,9 @@ class Message(Object, Update):
if self.message_thread_id:
message_thread_id = self.message_thread_id
if business_connection_id is None and self.business_connection_id:
business_connection_id = self.business_connection_id
chat_id = self.chat.id
reply_to_chat_id = None
if reply_in_chat_id is not None:
@ -1984,6 +2031,7 @@ class Message(Object, Update):
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,
reply_to_chat_id=reply_to_chat_id,
business_connection_id=business_connection_id,
quote_text=quote_text,
quote_entities=quote_entities,
parse_mode=parse_mode,
@ -2002,6 +2050,7 @@ class Message(Object, Update):
force_document: bool = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
business_connection_id: str = None,
reply_in_chat_id: Union[int, str] = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
@ -2075,6 +2124,10 @@ class Message(Object, Update):
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message.
business_connection_id (``str``, *optional*):
Business connection identifier.
for business bots only.
reply_in_chat_id: Union[int, str] = None,
Unique identifier of target chat.
for reply message in another chat.
@ -2134,6 +2187,9 @@ class Message(Object, Update):
if self.message_thread_id:
message_thread_id = self.message_thread_id
if business_connection_id is None and self.business_connection_id:
business_connection_id = self.business_connection_id
chat_id = self.chat.id
reply_to_chat_id = None
if reply_in_chat_id is not None:
@ -2152,6 +2208,7 @@ class Message(Object, Update):
disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,
business_connection_id=business_connection_id,
reply_to_chat_id=reply_to_chat_id,
quote_text=quote_text,
quote_entities=quote_entities,
@ -2167,6 +2224,7 @@ class Message(Object, Update):
quote: bool = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
business_connection_id: str = None,
reply_markup: Union[
"types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup",
@ -2206,6 +2264,10 @@ class Message(Object, Update):
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message.
business_connection_id (``str``, *optional*):
Business connection identifier.
for business bots only.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
An object for an inline keyboard. If empty, one Play game_title button will be shown automatically.
If not empty, the first button must launch the game.
@ -2222,6 +2284,9 @@ class Message(Object, Update):
if reply_to_message_id is None and quote:
reply_to_message_id = self.id
if business_connection_id is None and self.business_connection_id:
business_connection_id = self.business_connection_id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
@ -2232,6 +2297,7 @@ class Message(Object, Update):
disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,
business_connection_id=business_connection_id,
reply_markup=reply_markup
)
@ -2323,6 +2389,7 @@ class Message(Object, Update):
quote: bool = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
business_connection_id: str = None,
reply_in_chat_id: Union[int, str] = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
@ -2370,6 +2437,10 @@ class Message(Object, Update):
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message
business_connection_id (``str``, *optional*):
Business connection identifier.
for business bots only.
reply_in_chat_id: Union[int, str] = None,
Unique identifier of target chat.
for reply message in another chat.
@ -2403,6 +2474,9 @@ class Message(Object, Update):
if reply_to_message_id is None and quote:
reply_to_message_id = self.id
if business_connection_id is None and self.business_connection_id:
business_connection_id = self.business_connection_id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
@ -2420,6 +2494,7 @@ class Message(Object, Update):
disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,
business_connection_id=business_connection_id,
reply_to_chat_id=reply_to_chat_id,
quote_text=quote_text,
quote_entities=quote_entities,
@ -2439,6 +2514,7 @@ class Message(Object, Update):
disable_notification: bool = None,
reply_to_message_id: int = None,
reply_in_chat_id: Union[int, str] = None,
business_connection_id: str = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
parse_mode: Optional["enums.ParseMode"] = None
@ -2477,6 +2553,10 @@ class Message(Object, Update):
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message.
business_connection_id (``str``, *optional*):
Business connection identifier.
for business bots only.
reply_in_chat_id: Union[int, str] = None,
Unique identifier of target chat.
for reply message in another chat.
@ -2502,6 +2582,9 @@ class Message(Object, Update):
if reply_to_message_id is None and quote:
reply_to_message_id = self.id
if business_connection_id is None and self.business_connection_id:
business_connection_id = self.business_connection_id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
@ -2518,6 +2601,7 @@ class Message(Object, Update):
disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,
business_connection_id=business_connection_id,
reply_to_chat_id=reply_to_chat_id,
quote_text=quote_text
)
@ -2533,6 +2617,7 @@ class Message(Object, Update):
ttl_seconds: int = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
business_connection_id: str = None,
reply_in_chat_id: Union[int, str] = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
@ -2598,6 +2683,10 @@ class Message(Object, Update):
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message.
business_connection_id (``str``, *optional*):
Business connection identifier.
for business bots only.
reply_in_chat_id: Union[int, str] = None,
Unique identifier of target chat.
for reply message in another chat.
@ -2650,6 +2739,9 @@ class Message(Object, Update):
if reply_to_message_id is None and quote:
reply_to_message_id = self.id
if business_connection_id is None and self.business_connection_id:
business_connection_id = self.business_connection_id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
@ -2671,6 +2763,7 @@ class Message(Object, Update):
disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,
business_connection_id=business_connection_id,
reply_to_chat_id=reply_to_chat_id,
quote_text=quote_text,
quote_entities=quote_entities,
@ -2697,6 +2790,7 @@ class Message(Object, Update):
disable_notification: bool = None,
protect_content: bool = None,
reply_to_message_id: int = None,
business_connection_id: str = None,
reply_in_chat_id: Union[int, str] = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
@ -2788,6 +2882,10 @@ class Message(Object, Update):
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message.
business_connection_id (``str``, *optional*):
Business connection identifier.
for business bots only.
reply_in_chat_id: Union[int, str] = None,
Unique identifier of target chat.
for reply message in another chat.
@ -2824,6 +2922,9 @@ class Message(Object, Update):
if reply_to_message_id is None and quote:
reply_to_message_id = self.id
if business_connection_id is None and self.business_connection_id:
business_connection_id = self.business_connection_id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
@ -2851,6 +2952,7 @@ class Message(Object, Update):
disable_notification=disable_notification,
protect_content=protect_content,
message_thread_id=message_thread_id,
business_connection_id=business_connection_id,
reply_to_message_id=reply_to_message_id,
reply_to_chat_id=reply_to_chat_id,
quote_text=quote_text,
@ -2866,6 +2968,7 @@ class Message(Object, Update):
quote: bool = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
business_connection_id: str = None,
reply_in_chat_id: Union[int, str] = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
@ -2914,6 +3017,10 @@ class Message(Object, Update):
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message.
business_connection_id (``str``, *optional*):
Business connection identifier.
for business bots only.
reply_in_chat_id: Union[int, str] = None,
Unique identifier of target chat.
for reply message in another chat.
@ -2971,6 +3078,9 @@ class Message(Object, Update):
if reply_to_message_id is None and quote:
reply_to_message_id = self.id
if business_connection_id is None and self.business_connection_id:
business_connection_id = self.business_connection_id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
@ -2987,6 +3097,7 @@ class Message(Object, Update):
disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,
business_connection_id=business_connection_id,
reply_to_chat_id=reply_to_chat_id,
quote_text=quote_text,
quote_entities=quote_entities,
@ -3007,6 +3118,7 @@ class Message(Object, Update):
foursquare_type: str = "",
disable_notification: bool = None,
reply_to_message_id: int = None,
business_connection_id: str = None,
reply_in_chat_id: Union[int, str] = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
@ -3069,6 +3181,10 @@ class Message(Object, Update):
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message
business_connection_id (``str``, *optional*):
Business connection identifier.
for business bots only.
reply_in_chat_id: Union[int, str] = None,
Unique identifier of target chat.
for reply message in another chat.
@ -3102,6 +3218,9 @@ class Message(Object, Update):
if reply_to_message_id is None and quote:
reply_to_message_id = self.id
if business_connection_id is None and self.business_connection_id:
business_connection_id = self.business_connection_id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
@ -3123,6 +3242,7 @@ class Message(Object, Update):
disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,
business_connection_id=business_connection_id,
reply_to_chat_id=reply_to_chat_id,
quote_text=quote_text,
quote_entities=quote_entities,
@ -3147,6 +3267,7 @@ class Message(Object, Update):
supports_streaming: bool = True,
disable_notification: bool = None,
reply_to_message_id: int = None,
business_connection_id: str = None,
reply_in_chat_id: Union[int, str] = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
@ -3234,6 +3355,10 @@ class Message(Object, Update):
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message.
business_connection_id (``str``, *optional*):
Business connection identifier.
for business bots only.
reply_in_chat_id: Union[int, str] = None,
Unique identifier of target chat.
for reply message in another chat.
@ -3286,6 +3411,9 @@ class Message(Object, Update):
if reply_to_message_id is None and quote:
reply_to_message_id = self.id
if business_connection_id is None and self.business_connection_id:
business_connection_id = self.business_connection_id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
@ -3313,6 +3441,7 @@ class Message(Object, Update):
disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,
business_connection_id=business_connection_id,
reply_to_chat_id=reply_to_chat_id,
quote_text=quote_text,
quote_entities=quote_entities,
@ -3330,6 +3459,7 @@ class Message(Object, Update):
thumb: Union[str, BinaryIO] = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
business_connection_id: str = None,
reply_in_chat_id: Union[int, str] = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
@ -3392,6 +3522,10 @@ class Message(Object, Update):
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message
business_connection_id (``str``, *optional*):
Business connection identifier.
for business bots only.
reply_in_chat_id: Union[int, str] = None,
Unique identifier of target chat.
for reply message in another chat.
@ -3452,6 +3586,9 @@ class Message(Object, Update):
if reply_to_message_id is None and quote:
reply_to_message_id = self.id
if business_connection_id is None and self.business_connection_id:
business_connection_id = self.business_connection_id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
@ -3471,6 +3608,7 @@ class Message(Object, Update):
disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,
business_connection_id=business_connection_id,
reply_to_chat_id=reply_to_chat_id,
quote_text=quote_text,
quote_entities=quote_entities,
@ -3492,6 +3630,7 @@ class Message(Object, Update):
duration: int = 0,
disable_notification: bool = None,
reply_to_message_id: int = None,
business_connection_id: str = None,
reply_in_chat_id: Union[int, str] = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
@ -3552,6 +3691,10 @@ class Message(Object, Update):
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message
business_connection_id (``str``, *optional*):
Business connection identifier.
for business bots only.
reply_in_chat_id: Union[int, str] = None,
Unique identifier of target chat.
for reply message in another chat.
@ -3604,6 +3747,9 @@ class Message(Object, Update):
if reply_to_message_id is None and quote:
reply_to_message_id = self.id
if business_connection_id is None and self.business_connection_id:
business_connection_id = self.business_connection_id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
@ -3624,6 +3770,7 @@ class Message(Object, Update):
disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,
business_connection_id=business_connection_id,
reply_to_chat_id=reply_to_chat_id,
quote_text=quote_text,
quote_entities=quote_entities,
@ -3642,6 +3789,7 @@ class Message(Object, Update):
invert_media: bool = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
business_connection_id: str = None,
reply_in_chat_id: Union[int, str] = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
@ -3698,6 +3846,10 @@ class Message(Object, Update):
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message.
business_connection_id (``str``, *optional*):
Business connection identifier.
for business bots only.
reply_in_chat_id: Union[int, str] = None,
Unique identifier of target chat.
for reply message in another chat.
@ -3733,6 +3885,9 @@ class Message(Object, Update):
if reply_to_message_id is None and quote:
reply_to_message_id = self.id
if business_connection_id is None and self.business_connection_id:
business_connection_id = self.business_connection_id
message_thread_id = None
if self.message_thread_id:
message_thread_id = self.message_thread_id
@ -3754,6 +3909,7 @@ class Message(Object, Update):
disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,
business_connection_id=business_connection_id,
reply_to_chat_id=reply_to_chat_id,
quote_text=quote_text,
quote_entities=quote_entities,