From 2cf95ce2b90f0f5b543cdc04a9f1ffe41ea27296 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 4 Aug 2018 11:16:51 +0200 Subject: [PATCH] Fix accessing buttons on messages with reply markup --- telethon/tl/custom/message.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/telethon/tl/custom/message.py b/telethon/tl/custom/message.py index ab9fb6a7..df965b52 100644 --- a/telethon/tl/custom/message.py +++ b/telethon/tl/custom/message.py @@ -676,6 +676,10 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC): to know what bot we want to start. Raises ``ValueError`` if the bot cannot be found but is needed. Returns ``None`` if it's not needed. """ + if not isinstance(self.reply_markup, ( + types.ReplyInlineMarkup, types.ReplyKeyboardMarkup)): + return None + for row in self.reply_markup.rows: for button in row.buttons: if isinstance(button, types.KeyboardButtonSwitchInline):