mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 12:51:18 +00:00
Handle cases where denied_permissions might be None
This commit is contained in:
parent
937987a361
commit
8a99f996ab
@ -81,16 +81,17 @@ class ChatPermissions(Object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _parse(denied_permissions: types.ChatBannedRights) -> "ChatPermissions":
|
def _parse(denied_permissions: types.ChatBannedRights) -> "ChatPermissions":
|
||||||
return ChatPermissions(
|
if isinstance(denied_permissions, types.ChatBannedRights):
|
||||||
can_send_messages=not denied_permissions.send_messages,
|
return ChatPermissions(
|
||||||
can_send_media_messages=not denied_permissions.send_media,
|
can_send_messages=not denied_permissions.send_messages,
|
||||||
can_send_other_messages=(
|
can_send_media_messages=not denied_permissions.send_media,
|
||||||
not denied_permissions.send_stickers or not denied_permissions.send_gifs or
|
can_send_other_messages=(
|
||||||
not denied_permissions.send_games or not denied_permissions.send_inline
|
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_add_web_page_previews=not denied_permissions.embed_links,
|
||||||
can_change_info=not denied_permissions.change_info,
|
can_send_polls=not denied_permissions.send_polls,
|
||||||
can_invite_users=not denied_permissions.invite_users,
|
can_change_info=not denied_permissions.change_info,
|
||||||
can_pin_messages=not denied_permissions.pin_messages
|
can_invite_users=not denied_permissions.invite_users,
|
||||||
)
|
can_pin_messages=not denied_permissions.pin_messages
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user