From 9afe2f853d8d1e954a2f051dde1ca5ccaa56d5f1 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 16 Mar 2024 23:45:58 +0100 Subject: [PATCH] Fix footgun in get_chats --- client/src/telethon/_impl/client/client/client.py | 4 +++- client/src/telethon/_impl/client/client/users.py | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/src/telethon/_impl/client/client/client.py b/client/src/telethon/_impl/client/client/client.py index ce1f9fd9..fd8d47a0 100644 --- a/client/src/telethon/_impl/client/client/client.py +++ b/client/src/telethon/_impl/client/client/client.py @@ -690,7 +690,9 @@ class Client: """ return get_admin_log(self, chat) - async def get_chats(self, chats: Sequence[ChatLike]) -> List[Chat]: + async def get_chats( + self, chats: Union[List[ChatLike], Tuple[ChatLike, ...]] + ) -> List[Chat]: """ Get the latest basic information about the given chats. diff --git a/client/src/telethon/_impl/client/client/users.py b/client/src/telethon/_impl/client/client/users.py index ed1d2ac8..47911843 100644 --- a/client/src/telethon/_impl/client/client/users.py +++ b/client/src/telethon/_impl/client/client/users.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, List, Optional, Sequence, Union +from typing import TYPE_CHECKING, List, Optional, Tuple, Union from ...mtproto import RpcError from ...session import PackedChat, PackedType @@ -74,7 +74,9 @@ async def resolve_username(self: Client, username: str) -> Chat: ) -async def get_chats(self: Client, chats: Sequence[ChatLike]) -> List[Chat]: +async def get_chats( + self: Client, chats: Union[List[ChatLike], Tuple[ChatLike, ...]] +) -> List[Chat]: packed_chats: List[PackedChat] = [] input_users: List[types.InputUser] = [] input_chats: List[int] = []