mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 04:52:30 +00:00
Fix custom.Message.buttons being None in channels (#870)
The implications behind this were bigger than expected. The sender of the message is not actually needed for anything in the bot. The bot itself may be needed, but only for KeyboardButtonSwitchInline.
This commit is contained in:
@@ -14,9 +14,9 @@ class MessageButton:
|
||||
button (:tl:`KeyboardButton`):
|
||||
The original :tl:`KeyboardButton` object.
|
||||
"""
|
||||
def __init__(self, client, original, from_user, chat, msg_id):
|
||||
def __init__(self, client, original, chat, bot, msg_id):
|
||||
self.button = original
|
||||
self._from = from_user
|
||||
self._bot = bot
|
||||
self._chat = chat
|
||||
self._msg_id = msg_id
|
||||
self._client = client
|
||||
@@ -82,7 +82,7 @@ class MessageButton:
|
||||
return None
|
||||
elif isinstance(self.button, types.KeyboardButtonSwitchInline):
|
||||
return await self._client(functions.messages.StartBotRequest(
|
||||
bot=self._from, peer=self._chat, start_param=self.button.query
|
||||
bot=self._bot, peer=self._chat, start_param=self.button.query
|
||||
))
|
||||
elif isinstance(self.button, types.KeyboardButtonUrl):
|
||||
return webbrowser.open(self.button.url)
|
||||
|
Reference in New Issue
Block a user