diff --git a/telethon/tl/custom/message.py b/telethon/tl/custom/message.py index 50af0bd4..37becb1b 100644 --- a/telethon/tl/custom/message.py +++ b/telethon/tl/custom/message.py @@ -512,10 +512,8 @@ class Message: async def click(self, i=None, j=None, *, text=None, filter=None): """ - Clicks the inline keyboard button of the message, if any. - - If the message has a non-inline keyboard, clicking it will - send the message, switch to inline, or open its URL. + Calls `telethon.tl.custom.messagebutton.MessageButton.click` + for the specified button. Does nothing if the message has no buttons. diff --git a/telethon/tl/custom/messagebutton.py b/telethon/tl/custom/messagebutton.py index 80525218..7d3e4d50 100644 --- a/telethon/tl/custom/messagebutton.py +++ b/telethon/tl/custom/messagebutton.py @@ -54,10 +54,20 @@ class MessageButton: async def click(self): """ - Clicks the inline keyboard button of the message, if any. + Emulates the behaviour of clicking this button. - If the message has a non-inline keyboard, clicking it will - send the message, switch to inline, or open its URL. + If it's a normal :tl:`KeyboardButton` with text, a message will be + sent, and the sent `telethon.tl.custom.message.Message` returned. + + If it's an inline :tl:`KeyboardButtonCallback` with text and data, + it will be "clicked" and the :tl:`BotCallbackAnswer` returned. + + If it's an inline :tl:`KeyboardButtonSwitchInline` button, the + :tl:`StartBotRequest` will be invoked and the resulting updates + returned. + + If it's a :tl:`KeyboardButtonUrl`, the URL of the button will + be passed to ``webbrowser.open`` and return ``True`` on success. """ if isinstance(self.button, types.KeyboardButton): return await self._client.send_message(