2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 13:27:47 +00:00

Revert: CallbackQuery edit_* bound methods renamed to edit_message_*

This commit is contained in:
Dan 2019-06-14 04:53:04 +02:00
parent 61ed44ff5f
commit ef8f3bd6e1
2 changed files with 67 additions and 91 deletions

View File

@ -81,13 +81,13 @@ CallbackQuery
^^^^^^^^^^^^^ ^^^^^^^^^^^^^
.. hlist:: .. hlist::
:columns: 3 :columns: 4
- :meth:`~CallbackQuery.answer` - :meth:`~CallbackQuery.answer`
- :meth:`~CallbackQuery.edit_message_text` - :meth:`~CallbackQuery.edit_text`
- :meth:`~CallbackQuery.edit_message_caption` - :meth:`~CallbackQuery.edit_caption`
- :meth:`~CallbackQuery.edit_message_media` - :meth:`~CallbackQuery.edit_media`
- :meth:`~CallbackQuery.edit_message_reply_markup` - :meth:`~CallbackQuery.edit_reply_markup`
InlineQuery InlineQuery
^^^^^^^^^^^ ^^^^^^^^^^^
@ -141,10 +141,10 @@ Details
.. CallbackQuery .. CallbackQuery
.. automethod:: CallbackQuery.answer() .. automethod:: CallbackQuery.answer()
.. automethod:: CallbackQuery.edit_message_text() .. automethod:: CallbackQuery.edit_text()
.. automethod:: CallbackQuery.edit_message_caption() .. automethod:: CallbackQuery.edit_caption()
.. automethod:: CallbackQuery.edit_message_media() .. automethod:: CallbackQuery.edit_media()
.. automethod:: CallbackQuery.edit_message_reply_markup() .. automethod:: CallbackQuery.edit_reply_markup()
.. InlineQuery .. InlineQuery
.. automethod:: InlineQuery.answer() .. automethod:: InlineQuery.answer()

View File

@ -173,14 +173,16 @@ class CallbackQuery(Object, Update):
cache_time=cache_time cache_time=cache_time
) )
def edit_message_text( def edit_text(
self, self,
text: str, text: str,
parse_mode: str = "", parse_mode: str = "",
disable_web_page_preview: bool = None, disable_web_page_preview: bool = None,
reply_markup: "pyrogram.InlineKeyboardMarkup" = None reply_markup: "pyrogram.InlineKeyboardMarkup" = None
) -> Union["pyrogram.Message", bool]: ) -> Union["pyrogram.Message", bool]:
"""Bound method *edit_message_text* of :obj:`CallbackQuery`. """Edit the text of messages attached to this callback query.
Bound method *edit_message_text* of :obj:`CallbackQuery`.
Parameters: Parameters:
text (``str``): text (``str``):
@ -203,34 +205,33 @@ class CallbackQuery(Object, Update):
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.
""" """
chat_id = None if self.inline_message_id is None:
message_id = None return self._client.edit_message_text(
inline_message_id = None chat_id=self.message.chat.id,
message_id=self.message.message_id,
text=text,
parse_mode=parse_mode,
disable_web_page_preview=disable_web_page_preview,
reply_markup=reply_markup
)
else:
return self._client.edit_inline_text(
inline_message_id=self.inline_message_id,
text=text,
parse_mode=parse_mode,
disable_web_page_preview=disable_web_page_preview,
reply_markup=reply_markup
)
if self.message is not None: def edit_caption(
chat_id = self.message.chat.id
message_id = self.message.message_id
if self.inline_message_id is not None:
inline_message_id = self.inline_message_id
return self._client.edit_message_text(
text=text,
chat_id=chat_id,
message_id=message_id,
inline_message_id=inline_message_id,
parse_mode=parse_mode,
disable_web_page_preview=disable_web_page_preview,
reply_markup=reply_markup
)
def edit_message_caption(
self, self,
caption: str, caption: str,
parse_mode: str = "", parse_mode: str = "",
reply_markup: "pyrogram.InlineKeyboardMarkup" = None reply_markup: "pyrogram.InlineKeyboardMarkup" = None
) -> Union["pyrogram.Message", bool]: ) -> Union["pyrogram.Message", bool]:
"""Bound method *edit_message_caption* of :obj:`CallbackQuery`. """Edit the caption of media messages attached to this callback query.
Bound method *edit_message_caption* of :obj:`CallbackQuery`.
Parameters: Parameters:
caption (``str``): caption (``str``):
@ -250,32 +251,16 @@ class CallbackQuery(Object, Update):
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.
""" """
chat_id = None return self.edit_text(caption, parse_mode, reply_markup)
message_id = None
inline_message_id = None
if self.message is not None: def edit_media(
chat_id = self.message.chat.id
message_id = self.message.message_id
if self.inline_message_id is not None:
inline_message_id = self.inline_message_id
return self._client.edit_message_text(
text=caption,
chat_id=chat_id,
message_id=message_id,
inline_message_id=inline_message_id,
parse_mode=parse_mode,
reply_markup=reply_markup
)
def edit_message_media(
self, self,
media: "pyrogram.InputMedia", media: "pyrogram.InputMedia",
reply_markup: "pyrogram.InlineKeyboardMarkup" = None reply_markup: "pyrogram.InlineKeyboardMarkup" = None
) -> Union["pyrogram.Message", bool]: ) -> Union["pyrogram.Message", bool]:
"""Bound method *edit_message_media* of :obj:`CallbackQuery`. """Edit animation, audio, document, photo or video messages attached to this callback query.
Bound method *edit_message_media* of :obj:`CallbackQuery`.
Parameters: Parameters:
media (:obj:`InputMedia`): media (:obj:`InputMedia`):
@ -291,30 +276,27 @@ class CallbackQuery(Object, Update):
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.
""" """
chat_id = None if self.inline_message_id is None:
message_id = None return self._client.edit_message_media(
inline_message_id = None chat_id=self.message.chat.id,
message_id=self.message.message_id,
media=media,
reply_markup=reply_markup
)
else:
return self._client.edit_inline_media(
inline_message_id=self.inline_message_id,
media=media,
reply_markup=reply_markup
)
if self.message is not None: def edit_reply_markup(
chat_id = self.message.chat.id
message_id = self.message.message_id
if self.inline_message_id is not None:
inline_message_id = self.inline_message_id
return self._client.edit_message_media(
media=media,
chat_id=chat_id,
message_id=message_id,
inline_message_id=inline_message_id,
reply_markup=reply_markup
)
def edit_message_reply_markup(
self, self,
reply_markup: "pyrogram.InlineKeyboardMarkup" = None reply_markup: "pyrogram.InlineKeyboardMarkup" = None
) -> Union["pyrogram.Message", bool]: ) -> Union["pyrogram.Message", bool]:
"""Bound method *edit_message_reply_markup* of :obj:`CallbackQuery`. """Edit only the reply markup of messages attached to this callback query.
Bound method *edit_message_reply_markup* of :obj:`CallbackQuery`.
Parameters: Parameters:
reply_markup (:obj:`InlineKeyboardMarkup`): reply_markup (:obj:`InlineKeyboardMarkup`):
@ -327,20 +309,14 @@ class CallbackQuery(Object, Update):
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.
""" """
chat_id = None if self.inline_message_id is None:
message_id = None return self._client.edit_message_reply_markup(
inline_message_id = None chat_id=self.message.chat.id,
message_id=self.message.message_id,
if self.message is not None: reply_markup=reply_markup
chat_id = self.message.chat.id )
message_id = self.message.message_id else:
return self._client.edit_inline_reply_markup(
if self.inline_message_id is not None: inline_message_id=self.inline_message_id,
inline_message_id = self.inline_message_id reply_markup=reply_markup
)
return self._client.edit_message_reply_markup(
reply_markup=reply_markup,
chat_id=chat_id,
message_id=message_id,
inline_message_id=inline_message_id
)