diff --git a/pyrogram/client/ext/utils.py b/pyrogram/client/ext/utils.py index c7a10db9..3f689f41 100644 --- a/pyrogram/client/ext/utils.py +++ b/pyrogram/client/ext/utils.py @@ -168,6 +168,7 @@ def parse_user(user: types.User) -> pyrogram_types.User or None: phone_number=user.phone, photo=parse_chat_photo(user.photo), status=parse_user_status(user.status, is_bot=user.bot), + restriction_reason=user.restriction_reason ) if user else None @@ -187,7 +188,8 @@ def parse_user_chat(user: types.User) -> pyrogram_types.Chat: username=user.username, first_name=user.first_name, last_name=user.last_name, - photo=parse_chat_photo(user.photo) + photo=parse_chat_photo(user.photo), + restriction_reason=user.restriction_reason ) @@ -212,7 +214,8 @@ def parse_channel_chat(channel: types.Channel) -> pyrogram_types.Chat: type="supergroup" if channel.megagroup else "channel", title=channel.title, username=getattr(channel, "username", None), - photo=parse_chat_photo(getattr(channel, "photo", None)) + photo=parse_chat_photo(getattr(channel, "photo", None)), + restriction_reason=channel.restriction_reason ) diff --git a/pyrogram/client/types/user_and_chats/chat.py b/pyrogram/client/types/user_and_chats/chat.py index afed1ca4..68eaa775 100644 --- a/pyrogram/client/types/user_and_chats/chat.py +++ b/pyrogram/client/types/user_and_chats/chat.py @@ -69,6 +69,9 @@ class Chat(Object): members_count (``int``, *optional*): Chat members count, for groups and channels only. + + restriction_reason (``str``, *optional*): + The reason why this chat might be unavailable to some users. """ ID = 0xb0700002 @@ -88,7 +91,8 @@ class Chat(Object): pinned_message=None, sticker_set_name: str = None, can_set_sticker_set: bool = None, - members_count: int = None + members_count: int = None, + restriction_reason: str = None ): self.id = id self.type = type @@ -104,3 +108,4 @@ class Chat(Object): self.sticker_set_name = sticker_set_name self.can_set_sticker_set = can_set_sticker_set self.members_count = members_count + self.restriction_reason = restriction_reason diff --git a/pyrogram/client/types/user_and_chats/user.py b/pyrogram/client/types/user_and_chats/user.py index 9c7eec1f..e0eb25cc 100644 --- a/pyrogram/client/types/user_and_chats/user.py +++ b/pyrogram/client/types/user_and_chats/user.py @@ -61,6 +61,9 @@ class User(Object): photo (:obj:`ChatPhoto `, *optional*): User's or bot's current profile photo. Suitable for downloads only. + + restriction_reason (``str``, *optional*): + The reason why this bot might be unavailable for some users. """ ID = 0xb0700001 @@ -79,7 +82,8 @@ class User(Object): username: str = None, language_code: str = None, phone_number: str = None, - photo=None + photo=None, + restriction_reason: str = None ): self.id = id self.is_self = is_self @@ -94,3 +98,4 @@ class User(Object): self.language_code = language_code self.phone_number = phone_number self.photo = photo + self.restriction_reason = restriction_reason