mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 20:14:51 +00:00
pyrofork: Refactor business_connection
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
561d3d3def
commit
869965acf3
7 changed files with 83 additions and 23 deletions
|
|
@ -67,6 +67,7 @@ class EditMessageCaption:
|
|||
|
||||
business_connection_id (``str``, *optional*):
|
||||
Unique identifier of the business connection.
|
||||
for business bots only.
|
||||
|
||||
Returns:
|
||||
:obj:`~pyrogram.types.Message`: On success, the edited message is returned.
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ class EditMessageMedia:
|
|||
|
||||
business_connection_id (``str``, *optional*):
|
||||
Unique identifier of the business connection.
|
||||
for business bots only.
|
||||
|
||||
Returns:
|
||||
:obj:`~pyrogram.types.Message`: On success, the edited message is returned.
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ class EditMessageReplyMarkup:
|
|||
|
||||
business_connection_id (``str``, *optional*):
|
||||
Unique identifier of the business connection.
|
||||
for business bots only.
|
||||
|
||||
Returns:
|
||||
:obj:`~pyrogram.types.Message`: On success, the edited message is returned.
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ class EditMessageText:
|
|||
|
||||
business_connection_id (``str``, *optional*):
|
||||
Unique identifier of the business connection.
|
||||
for business bots only.
|
||||
|
||||
Returns:
|
||||
:obj:`~pyrogram.types.Message`: On success, the edited message is returned.
|
||||
|
|
|
|||
|
|
@ -181,7 +181,8 @@ class CallbackQuery(Object, Update):
|
|||
text: str,
|
||||
parse_mode: Optional["enums.ParseMode"] = None,
|
||||
disable_web_page_preview: bool = None,
|
||||
reply_markup: "types.InlineKeyboardMarkup" = None
|
||||
reply_markup: "types.InlineKeyboardMarkup" = None,
|
||||
business_connection_id: Optional[str] = None
|
||||
) -> Union["types.Message", bool]:
|
||||
"""Edit the text of messages attached to callback queries.
|
||||
|
||||
|
|
@ -201,6 +202,10 @@ class CallbackQuery(Object, Update):
|
|||
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
|
||||
An InlineKeyboardMarkup object.
|
||||
|
||||
business_connection_id (``str``, *optional*):
|
||||
Unique identifier of the business connection.
|
||||
for business bots only.
|
||||
|
||||
Returns:
|
||||
:obj:`~pyrogram.types.Message` | ``bool``: On success, if the edited message was sent by the bot, the edited
|
||||
message is returned, otherwise True is returned (message sent via the bot, as inline query result).
|
||||
|
|
@ -224,15 +229,15 @@ class CallbackQuery(Object, Update):
|
|||
text=text,
|
||||
parse_mode=parse_mode,
|
||||
disable_web_page_preview=disable_web_page_preview,
|
||||
reply_markup=reply_markup,
|
||||
business_connection_id=getattr(self.message, "business_connection_id", None)
|
||||
reply_markup=reply_markup
|
||||
)
|
||||
|
||||
async def edit_message_caption(
|
||||
self,
|
||||
caption: str,
|
||||
parse_mode: Optional["enums.ParseMode"] = None,
|
||||
reply_markup: "types.InlineKeyboardMarkup" = None
|
||||
reply_markup: "types.InlineKeyboardMarkup" = None,
|
||||
business_connection_id: Optional[str] = None
|
||||
) -> Union["types.Message", bool]:
|
||||
"""Edit the caption of media messages attached to callback queries.
|
||||
|
||||
|
|
@ -249,6 +254,10 @@ class CallbackQuery(Object, Update):
|
|||
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
|
||||
An InlineKeyboardMarkup object.
|
||||
|
||||
business_connection_id (``str``, *optional*):
|
||||
Unique identifier of the business connection.
|
||||
for business bots only.
|
||||
|
||||
Returns:
|
||||
:obj:`~pyrogram.types.Message` | ``bool``: On success, if the edited message was sent by the bot, the edited
|
||||
message is returned, otherwise True is returned (message sent via the bot, as inline query result).
|
||||
|
|
@ -260,13 +269,18 @@ class CallbackQuery(Object, Update):
|
|||
caption,
|
||||
parse_mode,
|
||||
reply_markup=reply_markup,
|
||||
business_connection_id=getattr(self.message, "business_connection_id", None)
|
||||
business_connection_id=getattr(
|
||||
self.message,
|
||||
"business_connection_id",
|
||||
None
|
||||
) if business_connection_id is None else business_connection_id
|
||||
)
|
||||
|
||||
async def edit_message_media(
|
||||
self,
|
||||
media: "types.InputMedia",
|
||||
reply_markup: "types.InlineKeyboardMarkup" = None
|
||||
reply_markup: "types.InlineKeyboardMarkup" = None,
|
||||
business_connection_id: Optional[str] = None
|
||||
) -> Union["types.Message", bool]:
|
||||
"""Edit animation, audio, document, photo or video messages attached to callback queries.
|
||||
|
||||
|
|
@ -279,6 +293,10 @@ class CallbackQuery(Object, Update):
|
|||
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
|
||||
An InlineKeyboardMarkup object.
|
||||
|
||||
business_connection_id (``str``, *optional*):
|
||||
Unique identifier of the business connection.
|
||||
for business bots only.
|
||||
|
||||
Returns:
|
||||
:obj:`~pyrogram.types.Message` | ``bool``: On success, if the edited message was sent by the bot, the edited
|
||||
message is returned, otherwise True is returned (message sent via the bot, as inline query result).
|
||||
|
|
@ -292,19 +310,23 @@ class CallbackQuery(Object, Update):
|
|||
message_id=self.message.id,
|
||||
media=media,
|
||||
reply_markup=reply_markup,
|
||||
business_connection_id=getattr(self.message, "business_connection_id", None)
|
||||
business_connection_id=getattr(
|
||||
self.message,
|
||||
"business_connection_id",
|
||||
None
|
||||
) if business_connection_id is None else business_connection_id
|
||||
)
|
||||
else:
|
||||
return await self._client.edit_inline_media(
|
||||
inline_message_id=self.inline_message_id,
|
||||
media=media,
|
||||
reply_markup=reply_markup,
|
||||
business_connection_id=getattr(self.message, "business_connection_id", None)
|
||||
reply_markup=reply_markup
|
||||
)
|
||||
|
||||
async def edit_message_reply_markup(
|
||||
self,
|
||||
reply_markup: "types.InlineKeyboardMarkup" = None
|
||||
reply_markup: "types.InlineKeyboardMarkup" = None,
|
||||
business_connection_id: Optional[str] = None
|
||||
) -> Union["types.Message", bool]:
|
||||
"""Edit only the reply markup of messages attached to callback queries.
|
||||
|
||||
|
|
@ -314,6 +336,10 @@ class CallbackQuery(Object, Update):
|
|||
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`):
|
||||
An InlineKeyboardMarkup object.
|
||||
|
||||
business_connection_id (``str``, *optional*):
|
||||
Unique identifier of the business connection.
|
||||
for business bots only.
|
||||
|
||||
Returns:
|
||||
:obj:`~pyrogram.types.Message` | ``bool``: On success, if the edited message was sent by the bot, the edited
|
||||
message is returned, otherwise True is returned (message sent via the bot, as inline query result).
|
||||
|
|
@ -326,11 +352,14 @@ class CallbackQuery(Object, Update):
|
|||
chat_id=self.message.chat.id,
|
||||
message_id=self.message.id,
|
||||
reply_markup=reply_markup,
|
||||
business_connection_id=getattr(self.message, "business_connection_id", None)
|
||||
business_connection_id=getattr(
|
||||
self.message,
|
||||
"business_connection_id",
|
||||
None
|
||||
) if business_connection_id is None else business_connection_id
|
||||
)
|
||||
else:
|
||||
return await self._client.edit_inline_reply_markup(
|
||||
inline_message_id=self.inline_message_id,
|
||||
reply_markup=reply_markup,
|
||||
business_connection_id=getattr(self.message, "business_connection_id", None)
|
||||
reply_markup=reply_markup
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4066,7 +4066,8 @@ class Message(Object, Update):
|
|||
entities: List["types.MessageEntity"] = None,
|
||||
disable_web_page_preview: bool = None,
|
||||
invert_media: bool = None,
|
||||
reply_markup: "types.InlineKeyboardMarkup" = None
|
||||
reply_markup: "types.InlineKeyboardMarkup" = None,
|
||||
business_connection_id: str = None
|
||||
) -> "Message":
|
||||
"""Bound method *edit_text* of :obj:`~pyrogram.types.Message`.
|
||||
|
||||
|
|
@ -4107,6 +4108,10 @@ class Message(Object, Update):
|
|||
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
|
||||
An InlineKeyboardMarkup object.
|
||||
|
||||
business_connection_id (``str``, *optional*):
|
||||
Unique identifier of the business connection.
|
||||
for business bots only.
|
||||
|
||||
Returns:
|
||||
On success, the edited :obj:`~pyrogram.types.Message` is returned.
|
||||
|
||||
|
|
@ -4122,7 +4127,7 @@ class Message(Object, Update):
|
|||
disable_web_page_preview=disable_web_page_preview,
|
||||
invert_media=invert_media,
|
||||
reply_markup=reply_markup,
|
||||
business_connection_id=self.business_connection_id
|
||||
business_connection_id=self.business_connection_id if business_connection_id is None else business_connection_id
|
||||
)
|
||||
|
||||
edit = edit_text
|
||||
|
|
@ -4133,7 +4138,8 @@ class Message(Object, Update):
|
|||
parse_mode: Optional["enums.ParseMode"] = None,
|
||||
caption_entities: List["types.MessageEntity"] = None,
|
||||
invert_media: bool = None,
|
||||
reply_markup: "types.InlineKeyboardMarkup" = None
|
||||
reply_markup: "types.InlineKeyboardMarkup" = None,
|
||||
business_connection_id: str = None
|
||||
) -> "Message":
|
||||
"""Bound method *edit_caption* of :obj:`~pyrogram.types.Message`.
|
||||
|
||||
|
|
@ -4169,6 +4175,10 @@ class Message(Object, Update):
|
|||
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
|
||||
An InlineKeyboardMarkup object.
|
||||
|
||||
business_connection_id (``str``, *optional*):
|
||||
Unique identifier of the business connection.
|
||||
for business bots only.
|
||||
|
||||
Returns:
|
||||
On success, the edited :obj:`~pyrogram.types.Message` is returned.
|
||||
|
||||
|
|
@ -4183,14 +4193,15 @@ class Message(Object, Update):
|
|||
caption_entities=caption_entities,
|
||||
invert_media=invert_media,
|
||||
reply_markup=reply_markup,
|
||||
business_connection_id=self.business_connection_id
|
||||
business_connection_id=self.business_connection_id if business_connection_id is None else business_connection_id
|
||||
)
|
||||
|
||||
async def edit_media(
|
||||
self,
|
||||
media: "types.InputMedia",
|
||||
invert_media: bool = None,
|
||||
reply_markup: "types.InlineKeyboardMarkup" = None
|
||||
reply_markup: "types.InlineKeyboardMarkup" = None,
|
||||
business_connection_id: str = None
|
||||
) -> "Message":
|
||||
"""Bound method *edit_media* of :obj:`~pyrogram.types.Message`.
|
||||
|
||||
|
|
@ -4219,6 +4230,10 @@ class Message(Object, Update):
|
|||
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
|
||||
An InlineKeyboardMarkup object.
|
||||
|
||||
business_connection_id (``str``, *optional*):
|
||||
Unique identifier of the business connection.
|
||||
for business bots only.
|
||||
|
||||
Returns:
|
||||
On success, the edited :obj:`~pyrogram.types.Message` is returned.
|
||||
|
||||
|
|
@ -4231,10 +4246,14 @@ class Message(Object, Update):
|
|||
media=media,
|
||||
invert_media=invert_media,
|
||||
reply_markup=reply_markup,
|
||||
business_connection_id=self.business_connection_id
|
||||
business_connection_id=self.business_connection_id if business_connection_id is None else business_connection_id
|
||||
)
|
||||
|
||||
async def edit_reply_markup(self, reply_markup: "types.InlineKeyboardMarkup" = None) -> "Message":
|
||||
async def edit_reply_markup(
|
||||
self,
|
||||
reply_markup: "types.InlineKeyboardMarkup" = None,
|
||||
business_connection_id: str = None
|
||||
) -> "Message":
|
||||
"""Bound method *edit_reply_markup* of :obj:`~pyrogram.types.Message`.
|
||||
|
||||
Use as a shortcut for:
|
||||
|
|
@ -4256,6 +4275,10 @@ class Message(Object, Update):
|
|||
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`):
|
||||
An InlineKeyboardMarkup object.
|
||||
|
||||
business_connection_id (``str``, *optional*):
|
||||
Unique identifier of the business connection.
|
||||
for business bots only.
|
||||
|
||||
Returns:
|
||||
On success, if edited message is sent by the bot, the edited
|
||||
:obj:`~pyrogram.types.Message` is returned, otherwise True is returned.
|
||||
|
|
@ -4267,7 +4290,7 @@ class Message(Object, Update):
|
|||
chat_id=self.chat.id,
|
||||
message_id=self.id,
|
||||
reply_markup=reply_markup,
|
||||
business_connection_id=self.business_connection_id
|
||||
business_connection_id=self.business_connection_id if business_connection_id is None else business_connection_id
|
||||
)
|
||||
|
||||
async def forward(
|
||||
|
|
|
|||
|
|
@ -218,7 +218,8 @@ class Poll(Object, Update):
|
|||
|
||||
async def stop(
|
||||
self,
|
||||
reply_markup: "types.InlineKeyboardMarkup" = None
|
||||
reply_markup: "types.InlineKeyboardMarkup" = None,
|
||||
business_connection_id: str = None
|
||||
) -> "types.Poll":
|
||||
"""Bound method *stop* of :obj:`~pyrogram.types.Poll`.
|
||||
|
||||
|
|
@ -235,6 +236,9 @@ class Poll(Object, Update):
|
|||
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
|
||||
An InlineKeyboardMarkup object.
|
||||
|
||||
business_connection_id (``str``, *optional*):
|
||||
Unique identifier of the business connection.
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
|
|
@ -251,5 +255,5 @@ class Poll(Object, Update):
|
|||
chat_id=self.chat.id,
|
||||
message_id=self.id,
|
||||
reply_markup=reply_markup,
|
||||
business_connection_id=self.business_connection_id
|
||||
business_connection_id=self.business_connection_id if business_connection_id is None else business_connection_id
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue