try to get PackedChat from cache by abcs.Peer before constructing one with no access_hash

Co-authored-by: Lonami <totufals@hotmail.com>
This commit is contained in:
apepenkov 2023-11-10 09:17:53 +03:00 committed by GitHub
parent 0ae7300cda
commit 54cfb7f102
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,