Fix lack of support for anon channel restrictions (#4130)

This commit is contained in:
rozha 2023-06-09 18:42:34 +03:00 committed by GitHub
parent 2826c942c0
commit 1e63de9b68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1116,8 +1116,8 @@ class ChatMethods:
user = await self.get_input_entity(user) user = await self.get_input_entity(user)
ty = helpers._entity_type(user) ty = helpers._entity_type(user)
if ty != helpers._EntityType.USER: if ty not in (helpers._EntityType.USER, helpers._EntityType.CHANNEL):
raise ValueError('You must pass a user entity') raise ValueError('You must pass a user or channel entity')
if isinstance(user, types.InputPeerSelf): if isinstance(user, types.InputPeerSelf):
raise ValueError('You cannot restrict yourself') raise ValueError('You cannot restrict yourself')