-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[V2] add inlinecallback to buttoncallback event #4252
base: v2
Are you sure you want to change the base?
[V2] add inlinecallback to buttoncallback event #4252
Conversation
@@ -75,8 +88,10 @@ async def get_message(self) -> Optional[Message]: | |||
""" | |||
Get the :class:`~telethon.types.Message` containing the button that was clicked. | |||
|
|||
If the message is too old and is no longer accessible, :data:`None` is returned instead. | |||
If the message is inline, or too old and is no longer accessible, :data:`None` is returned instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But isn't the purpose of using InputMessageCallbackQuery
the fact that it can work? functions.messages.get_messages
doesn't need a chat. CherryPickedList
does require one, so I see the problem.
But we should be able to fetch the message without a chat. So maybe we need to rethink this method's implementation.
Getting message from inline doesn't really work, unless peer is known. Not sure if it should. Needs to be investigated |
For the editing of inline messages - there are multiple options what to do with it.
My opinion - 2nd or 3rd are the best options. 3rd is better for users, 2nd is better for maitainers - especially since |
return isinstance(self._raw, types.UpdateInlineBotCallbackQuery) | ||
|
||
@property | ||
def message_id(self) -> typing.Union[int, abcs.InputBotInlineMessageId]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should never return abcs
to the user. They're in a private package.
|
||
if owner_id > 0: | ||
# We can't know if it's really a chat with user, or an ID of the user who issued the inline query. | ||
# So it's better to return None, then to return wrong chat. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo then
-> than
.
Still a bit weird that there's no way to tell. Does the update type not contain any other hint elsewhere?
if packed: | ||
access_hash = packed.access_hash | ||
|
||
return Channel._from_raw( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not check the chat_map
with the owner_id
first?
Co-authored-by: Lonami <[email protected]>
Co-authored-by: Lonami <[email protected]>
Co-authored-by: Lonami <[email protected]>
Note - message id, that is unpacked from |
Allow
ButtonCallback
event to handleUpdateInlineBotCallbackQuery
, addchat
property to it