diff --git a/pyrogram/client/types/user_and_chats/chat_permissions.py b/pyrogram/client/types/user_and_chats/chat_permissions.py index e4b0b0d0..09c33089 100644 --- a/pyrogram/client/types/user_and_chats/chat_permissions.py +++ b/pyrogram/client/types/user_and_chats/chat_permissions.py @@ -81,16 +81,17 @@ class ChatPermissions(Object): @staticmethod def _parse(denied_permissions: types.ChatBannedRights) -> "ChatPermissions": - return ChatPermissions( - can_send_messages=not denied_permissions.send_messages, - can_send_media_messages=not denied_permissions.send_media, - can_send_other_messages=( - not denied_permissions.send_stickers or not denied_permissions.send_gifs or - not denied_permissions.send_games or not denied_permissions.send_inline - ), - can_add_web_page_previews=not denied_permissions.embed_links, - can_send_polls=not denied_permissions.send_polls, - can_change_info=not denied_permissions.change_info, - can_invite_users=not denied_permissions.invite_users, - can_pin_messages=not denied_permissions.pin_messages - ) + if isinstance(denied_permissions, types.ChatBannedRights): + return ChatPermissions( + can_send_messages=not denied_permissions.send_messages, + can_send_media_messages=not denied_permissions.send_media, + can_send_other_messages=( + not denied_permissions.send_stickers or not denied_permissions.send_gifs or + not denied_permissions.send_games or not denied_permissions.send_inline + ), + can_add_web_page_previews=not denied_permissions.embed_links, + can_send_polls=not denied_permissions.send_polls, + can_change_info=not denied_permissions.change_info, + can_invite_users=not denied_permissions.invite_users, + can_pin_messages=not denied_permissions.pin_messages + )