mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-16 12:25:45 +01:00
Add edit_* family of methods to Message.
This commit is contained in:
parent
9d0e0386d9
commit
a996e8873f
1 changed files with 42 additions and 0 deletions
|
@ -412,6 +412,48 @@ class Message(TelegramObject):
|
|||
disable_notification=disable_notification,
|
||||
message_id=self.message_id)
|
||||
|
||||
def edit_text(self, *args, **kwargs):
|
||||
"""
|
||||
Shortcut for ``bot.editMessageText(chat_id=message.chat_id,
|
||||
message_id=message.message_id,
|
||||
*args, **kwargs)``
|
||||
|
||||
Note:
|
||||
You can only edit messages that the bot sent itself,
|
||||
therefore this method can only be used on the
|
||||
return value of the bot.send_* family of methods.
|
||||
"""
|
||||
return self.bot.edit_message_text(
|
||||
chat_id=self.chat_id, message_id=self.message_id, *args, **kwargs)
|
||||
|
||||
def edit_caption(self, *args, **kwargs):
|
||||
"""
|
||||
Shortcut for ``bot.editMessageCaption(chat_id=message.chat_id,
|
||||
message_id=message.message_id,
|
||||
*args, **kwargs)``
|
||||
|
||||
Note:
|
||||
You can only edit messages that the bot sent itself,
|
||||
therefore this method can only be used on the
|
||||
return value of the bot.send_* family of methods.
|
||||
"""
|
||||
return self.bot.edit_message_caption(
|
||||
chat_id=self.chat_id, message_id=self.message_id, *args, **kwargs)
|
||||
|
||||
def edit_reply_markup(self, *args, **kwargs):
|
||||
"""
|
||||
Shortcut for ``bot.editReplyMarkup(chat_id=message.chat_id,
|
||||
message_id=message.message_id,
|
||||
*args, **kwargs)``
|
||||
|
||||
Note:
|
||||
You can only edit messages that the bot sent itself,
|
||||
therefore this method can only be used on the
|
||||
return value of the bot.send_* family of methods.
|
||||
"""
|
||||
return self.bot.edit_message_caption(
|
||||
chat_id=self.chat_id, message_id=self.message_id, *args, **kwargs)
|
||||
|
||||
def parse_entity(self, entity):
|
||||
"""
|
||||
Returns the text from a given :class:`telegram.MessageEntity`.
|
||||
|
|
Loading…
Add table
Reference in a new issue