messages; edit: fix inline messages of type InputBotInlineMessageID64

This commit is contained in:
Marcel Alexandru Nitan 2023-04-07 13:20:09 +03:00
parent 516a2e7435
commit f84f594ea6
2 changed files with 6 additions and 6 deletions

View File

@ -1064,7 +1064,7 @@ class MessageMethods:
from it, so the next parameter will be assumed to be the
message text.
You may also pass a :tl:`InputBotInlineMessageID`,
You may also pass a :tl:`InputBotInlineMessageID` or :tl:`InputBotInlineMessageID64`,
which is the only way to edit messages that were sent
after the user selects an inline query result.
@ -1136,7 +1136,7 @@ class MessageMethods:
Returns
The edited `Message <telethon.tl.custom.message.Message>`,
unless `entity` was a :tl:`InputBotInlineMessageID` in which
unless `entity` was a :tl:`InputBotInlineMessageID` or :tl:`InputBotInlineMessageID64` in which
case this method returns a boolean.
Raises
@ -1162,7 +1162,7 @@ class MessageMethods:
# or
await client.edit_message(message, 'hello!!!')
"""
if isinstance(entity, types.InputBotInlineMessageID):
if isinstance(entity, (types.InputBotInlineMessageID, types.InputBotInlineMessageID64)):
text = text or message
message = entity
elif isinstance(entity, types.Message):
@ -1178,7 +1178,7 @@ class MessageMethods:
attributes=attributes,
force_document=force_document)
if isinstance(entity, types.InputBotInlineMessageID):
if isinstance(entity, (types.InputBotInlineMessageID, types.InputBotInlineMessageID64)):
request = functions.messages.EditInlineBotMessageRequest(
id=entity,
message=text,

View File

@ -299,7 +299,7 @@ class CallbackQuery(EventBuilder):
"""
Edits the message. Shorthand for
`telethon.client.messages.MessageMethods.edit_message` with
the ``entity`` set to the correct :tl:`InputBotInlineMessageID`.
the ``entity`` set to the correct :tl:`InputBotInlineMessageID` or :tl:`InputBotInlineMessageID64`.
Returns `True` if the edit was successful.
@ -312,7 +312,7 @@ class CallbackQuery(EventBuilder):
since the message object is normally not present.
"""
self._client.loop.create_task(self.answer())
if isinstance(self.query.msg_id, types.InputBotInlineMessageID):
if isinstance(self.query.msg_id, (types.InputBotInlineMessageID, types.InputBotInlineMessageID64)):
return await self._client.edit_message(
self.query.msg_id, *args, **kwargs
)