From 1e63de9b68436ed380fbd7dc410cb783aa6e6f27 Mon Sep 17 00:00:00 2001 From: rozha Date: Fri, 9 Jun 2023 18:42:34 +0300 Subject: [PATCH] Fix lack of support for anon channel restrictions (#4130) --- telethon/client/chats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telethon/client/chats.py b/telethon/client/chats.py index 73dc0312..d3843833 100644 --- a/telethon/client/chats.py +++ b/telethon/client/chats.py @@ -1116,8 +1116,8 @@ class ChatMethods: user = await self.get_input_entity(user) ty = helpers._entity_type(user) - if ty != helpers._EntityType.USER: - raise ValueError('You must pass a user entity') + if ty not in (helpers._EntityType.USER, helpers._EntityType.CHANNEL): + raise ValueError('You must pass a user or channel entity') if isinstance(user, types.InputPeerSelf): raise ValueError('You cannot restrict yourself')