mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-04 20:20:23 +03:00
update get_message to use InputMessageCallbackQuery
This commit is contained in:
parent
aeb19a3035
commit
8fbf7adb6c
|
@ -6,6 +6,7 @@ from ...tl import abcs, functions, types
|
|||
from ..types import Chat, Message
|
||||
from .event import Event
|
||||
from ..types.chat import peer_id
|
||||
from ..client.messages import CherryPickedList
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..client.client import Client
|
||||
|
@ -76,12 +77,16 @@ class ButtonCallback(Event):
|
|||
|
||||
If the message is too old and is no longer accessible, :data:`None` is returned instead.
|
||||
"""
|
||||
|
||||
pid = peer_id(self._raw.peer)
|
||||
chat = self._chat_map.get(pid)
|
||||
if not chat:
|
||||
chat = await self._client._resolve_to_packed(pid)
|
||||
|
||||
message = (await self._client.get_messages_with_ids(chat=chat, message_ids=[self._raw.msg_id]))[0]
|
||||
lst = CherryPickedList(self._client, chat, [])
|
||||
lst._ids.append(types.InputMessageCallbackQuery(id=self._raw.msg_id, query_id=self._raw.query_id))
|
||||
|
||||
message = (await lst)[0]
|
||||
|
||||
return message or None
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user