diff --git a/telethon/client/buttons.py b/telethon/client/buttons.py index e13f58b8..8af44352 100644 --- a/telethon/client/buttons.py +++ b/telethon/client/buttons.py @@ -47,7 +47,8 @@ class ButtonMethods(UpdateMethods): self.add_event_handler( button.callback, - events.CallbackQuery(data=button.data) + events.CallbackQuery(data=getattr( + button.button, 'data', None)) ) button = button.button diff --git a/telethon/client/dialogs.py b/telethon/client/dialogs.py index 5d953fd5..67cd52d0 100644 --- a/telethon/client/dialogs.py +++ b/telethon/client/dialogs.py @@ -162,9 +162,9 @@ class DialogMethods(UserMethods): *, timeout=None, total_timeout=60, max_messages=100, replies_are_responses=True): """ - Returns an iterator over the dialogs, yielding 'limit' at most. - Dialogs are the open "chats" or conversations with other people, - groups you have joined, or channels you are subscribed to. + Creates a `Conversation ` + with the given entity so you can easily send messages and await for + responses or other reactions. Refer to its documentation for more. Args: entity (`entity`): diff --git a/telethon/tl/custom/button.py b/telethon/tl/custom/button.py index 2029531d..6f04eb68 100644 --- a/telethon/tl/custom/button.py +++ b/telethon/tl/custom/button.py @@ -4,6 +4,15 @@ from .messagebutton import MessageButton class Button: """ + .. note:: + + This class is used to **define** reply markups, e.g. when + sending a message or replying to events. When you access + `Message.buttons ` + they are actually `MessageButton + `, + so you might want to refer to that class instead. + Helper class to allow defining ``reply_markup`` when sending a message with inline or keyboard buttons. @@ -30,11 +39,6 @@ class Button: self.callback = callback self.is_inline = self._is_inline(button) - @property - def data(self): - if isinstance(self.button, types.KeyboardButtonCallback): - return self.button.data - @classmethod def _is_inline(cls, button): """ diff --git a/telethon/tl/custom/messagebutton.py b/telethon/tl/custom/messagebutton.py index 6145d507..fad47509 100644 --- a/telethon/tl/custom/messagebutton.py +++ b/telethon/tl/custom/messagebutton.py @@ -5,6 +5,13 @@ import webbrowser class MessageButton: """ + .. note:: + + `Message.buttons ` + are instances of this type. If you want to **define** a reply + markup for e.g. sending messages, refer to `Button + ` instead. + Custom class that encapsulates a message button providing an abstraction to easily access some commonly needed features (such as clicking the button itself).