diff --git a/telethon/tl/custom/message.py b/telethon/tl/custom/message.py index 019ab3f8..d7203a03 100644 --- a/telethon/tl/custom/message.py +++ b/telethon/tl/custom/message.py @@ -1080,7 +1080,8 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC): for row in self.reply_markup.rows: for button in row.buttons: 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 if not bot: raise ValueError('No input sender')