Fix .get_buttons failing for some messages sent by the bot

Closes #1619.
This commit is contained in:
Lonami Exo 2020-11-07 11:59:56 +01:00
parent e4a6ec40cd
commit b02a22eaa3

View File

@ -1080,7 +1080,8 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC):
for row in self.reply_markup.rows: for row in self.reply_markup.rows:
for button in row.buttons: for button in row.buttons:
if isinstance(button, types.KeyboardButtonSwitchInline): if isinstance(button, types.KeyboardButtonSwitchInline):
if button.same_peer: # no via_bot_id means the bot sent the message itself (#1619)
if button.same_peer or not self.via_bot_id:
bot = self.input_sender bot = self.input_sender
if not bot: if not bot:
raise ValueError('No input sender') raise ValueError('No input sender')