From ea07cf8d128db619e3e611f409826048467adbe6 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Tue, 10 Jul 2018 16:13:58 +0200 Subject: [PATCH] Add buttons parameter to client.edit_message --- telethon/client/messages.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/telethon/client/messages.py b/telethon/client/messages.py index 84cb6e02..4932639d 100644 --- a/telethon/client/messages.py +++ b/telethon/client/messages.py @@ -538,7 +538,8 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods): async def edit_message( self, entity, message=None, text=None, - *, parse_mode=utils.Default, link_preview=True, file=None): + *, parse_mode=utils.Default, link_preview=True, file=None, + buttons=None): """ Edits the given message ID (to change its contents or disable preview). @@ -569,6 +570,13 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods): The file object that should replace the existing media in the message. + buttons (`list`, `custom.Button `, + :tl:`KeyboardButton`): + The matrix (list of lists), row list or button to be shown + after sending the message. This parameter will only work if + you have signed in as a bot. You can also pass your own + :tl:`ReplyMarkup` here. + Examples: >>> client = ... @@ -604,7 +612,8 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods): message=text, no_webpage=not link_preview, entities=msg_entities, - media=media + media=media, + reply_markup=self._build_reply_markup(buttons) ) msg = self._get_response_message(request, await self(request), entity) self._cache_media(msg, file, file_handle)