From 54cfb7f102806231ead9713b349d2b1c34137176 Mon Sep 17 00:00:00 2001 From: apepenkov <39992738+apepenkov@users.noreply.github.com> Date: Fri, 10 Nov 2023 09:17:53 +0300 Subject: [PATCH] try to get PackedChat from cache by abcs.Peer before constructing one with no access_hash Co-authored-by: Lonami --- client/src/telethon/_impl/client/client/users.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/src/telethon/_impl/client/client/users.py b/client/src/telethon/_impl/client/client/users.py index 020e13b9..22c99ae6 100644 --- a/client/src/telethon/_impl/client/client/users.py +++ b/client/src/telethon/_impl/client/client/users.py @@ -173,6 +173,9 @@ async def resolve_to_packed(client: Client, chat: Union[ChatLike, abcs.InputPeer raise RuntimeError("unexpected case") if isinstance(chat, abcs.Peer): + packed = client._chat_hashes.get(peer_id(chat)) + if packed is not None: + return packed if isinstance(chat, types.PeerUser): return PackedChat( ty=PackedType.USER,