1818
1919import pyrogram
2020from pyrogram .api import types
21+ from .chat_permissions import ChatPermissions
2122from .chat_photo import ChatPhoto
2223from ..pyrogram_type import PyrogramType
2324
@@ -44,9 +45,6 @@ class Chat(PyrogramType):
4445 last_name (``str``, *optional*):
4546 Last name of the other party in a private chat.
4647
47- all_members_are_administrators (``bool``, *optional*):
48- True if a basic group has "All Members Are Admins" enabled.
49-
5048 photo (:obj:`ChatPhoto <pyrogram.ChatPhoto>`, *optional*):
5149 Chat photo. Suitable for downloads only.
5250
@@ -86,15 +84,15 @@ def __init__(self,
8684 username : str = None ,
8785 first_name : str = None ,
8886 last_name : str = None ,
89- all_members_are_administrators : bool = None ,
9087 photo : ChatPhoto = None ,
9188 description : str = None ,
9289 invite_link : str = None ,
9390 pinned_message = None ,
9491 sticker_set_name : str = None ,
9592 can_set_sticker_set : bool = None ,
9693 members_count : int = None ,
97- restriction_reason : str = None ):
94+ restriction_reason : str = None ,
95+ default_permissions : "pyrogram.ChatPermissions" = None ):
9896 super ().__init__ (client )
9997
10098 self .id = id
@@ -103,7 +101,6 @@ def __init__(self,
103101 self .username = username
104102 self .first_name = first_name
105103 self .last_name = last_name
106- self .all_members_are_administrators = all_members_are_administrators
107104 self .photo = photo
108105 self .description = description
109106 self .invite_link = invite_link
@@ -112,6 +109,7 @@ def __init__(self,
112109 self .can_set_sticker_set = can_set_sticker_set
113110 self .members_count = members_count
114111 self .restriction_reason = restriction_reason
112+ self .default_permissions = default_permissions
115113
116114 @staticmethod
117115 def _parse_user_chat (client , user : types .User ) -> "Chat" :
@@ -128,17 +126,12 @@ def _parse_user_chat(client, user: types.User) -> "Chat":
128126
129127 @staticmethod
130128 def _parse_chat_chat (client , chat : types .Chat ) -> "Chat" :
131- admins_enabled = getattr (chat , "admins_enabled" , None )
132-
133- if admins_enabled is not None :
134- admins_enabled = not admins_enabled
135-
136129 return Chat (
137130 id = - chat .id ,
138131 type = "group" ,
139132 title = chat .title ,
140- all_members_are_administrators = admins_enabled ,
141133 photo = ChatPhoto ._parse (client , getattr (chat , "photo" , None )),
134+ default_permissions = ChatPermissions ._parse (chat .default_banned_rights ),
142135 client = client
143136 )
144137
@@ -151,6 +144,7 @@ def _parse_channel_chat(client, channel: types.Channel) -> "Chat":
151144 username = getattr (channel , "username" , None ),
152145 photo = ChatPhoto ._parse (client , getattr (channel , "photo" , None )),
153146 restriction_reason = getattr (channel , "restriction_reason" , None ),
147+ default_permissions = ChatPermissions ._parse (channel .default_banned_rights ),
154148 client = client
155149 )
156150
0 commit comments