From 222713005ff5bb50d7ff7031991630b85d8226fd Mon Sep 17 00:00:00 2001 From: Davte Date: Thu, 20 Feb 2020 23:54:42 +0100 Subject: [PATCH] edit_message_media method implemented --- davtelepot/__init__.py | 2 +- davtelepot/bot.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/davtelepot/__init__.py b/davtelepot/__init__.py index acb1793..f80de53 100644 --- a/davtelepot/__init__.py +++ b/davtelepot/__init__.py @@ -14,7 +14,7 @@ __author__ = "Davide Testa" __email__ = "davide@davte.it" __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"] __license__ = "GNU General Public License v3.0" -__version__ = "2.4.11" +__version__ = "2.4.12" __maintainer__ = "Davide Testa" __contact__ = "t.me/davte" diff --git a/davtelepot/bot.py b/davtelepot/bot.py index 5b5a3c1..c5d9ebd 100644 --- a/davtelepot/bot.py +++ b/davtelepot/bot.py @@ -1217,6 +1217,37 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject): ) 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, message_id=None, disable_notification=False): """Forward message from `from_chat_id` to `chat_id`.