From 2776df5192be9db908cae89ba1e754d231652df6 Mon Sep 17 00:00:00 2001 From: ChoiHwaa <107089378+ChoiHwaa@users.noreply.github.com> Date: Fri, 17 Jun 2022 16:32:39 +0100 Subject: [PATCH] Update chats.py Fix get and edit perms for basic chats --- telethon/client/chats.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/telethon/client/chats.py b/telethon/client/chats.py index 90e27875..442b54ba 100644 --- a/telethon/client/chats.py +++ b/telethon/client/chats.py @@ -1109,6 +1109,9 @@ class ChatMethods: await client.edit_permissions(chat, user) """ entity = await self.get_input_entity(entity) + ty = helpers._entity_type(entity) + if ty != helpers._EntityType.CHAT and ty != helpers._EntityType.CHANNEL: + raise ValueError('You must pass either a chat, channel or a supergroup') rights = types.ChatBannedRights( until_date=until_date, @@ -1132,9 +1135,8 @@ class ChatMethods: banned_rights=rights )) - ty = helpers._entity_type(entity) if ty != helpers._EntityType.CHANNEL: - raise ValueError('You must pass either a channel or a supergroup') + raise ValueError('You must pass either a channel or a supergroup to edit user\'s perms') user = await self.get_input_entity(user) ty = helpers._entity_type(user)