edit_message_media method implemented

This commit is contained in:
Davte 2020-02-20 23:54:42 +01:00
parent 0e7a93c5be
commit 222713005f
2 changed files with 32 additions and 1 deletions

View File

@ -14,7 +14,7 @@ __author__ = "Davide Testa"
__email__ = "davide@davte.it" __email__ = "davide@davte.it"
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"] __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
__license__ = "GNU General Public License v3.0" __license__ = "GNU General Public License v3.0"
__version__ = "2.4.11" __version__ = "2.4.12"
__maintainer__ = "Davide Testa" __maintainer__ = "Davide Testa"
__contact__ = "t.me/davte" __contact__ = "t.me/davte"

View File

@ -1217,6 +1217,37 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject):
) )
return edited_message return edited_message
async def edit_message_media(self,
chat_id=None, message_id=None,
inline_message_id=None,
media=None,
reply_markup=None,
caption=None,
parse_mode=None,
photo=None,
update=None):
if update is not None:
message_identifier = self.get_message_identifier(update)
if 'chat_id' in message_identifier:
chat_id = message_identifier['chat_id']
message_id = message_identifier['message_id']
if 'inline_message_id' in message_identifier:
inline_message_id = message_identifier['inline_message_id']
if media is None:
media = {}
if caption is not None:
media['caption'] = caption
if parse_mode is not None:
media['parse_mode'] =
if photo is not None:
media['type'] = 'photo'
media['media'] = photo
return await self.editMessageMedia(chat_id=chat_id,
message_id=message_id,
inline_message_id=inline_message_id,
media=media,
reply_markup=reply_markup)
async def forward_message(self, chat_id, update=None, from_chat_id=None, async def forward_message(self, chat_id, update=None, from_chat_id=None,
message_id=None, disable_notification=False): message_id=None, disable_notification=False):
"""Forward message from `from_chat_id` to `chat_id`. """Forward message from `from_chat_id` to `chat_id`.