From 1e727fbb4347283902bb87064a315805eb771adc Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 12 Jul 2018 00:54:13 +0200 Subject: [PATCH] Add extra attributes to User is_self, is_contact, is_mutual_contact and is_deleted --- pyrogram/client/ext/utils.py | 4 ++++ pyrogram/client/types/user.py | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/pyrogram/client/ext/utils.py b/pyrogram/client/ext/utils.py index eba4e65e..a99ee066 100644 --- a/pyrogram/client/ext/utils.py +++ b/pyrogram/client/ext/utils.py @@ -129,6 +129,10 @@ def parse_chat_photo(photo): def parse_user(user: types.User) -> pyrogram_types.User or None: return pyrogram_types.User( id=user.id, + is_self=user.is_self, + is_contact=user.contact, + is_mutual_contact=user.mutual_contact, + is_deleted=user.deleted, is_bot=user.bot, first_name=user.first_name, last_name=user.last_name, diff --git a/pyrogram/client/types/user.py b/pyrogram/client/types/user.py index 17510738..9ae5dab2 100644 --- a/pyrogram/client/types/user.py +++ b/pyrogram/client/types/user.py @@ -26,6 +26,18 @@ class User(Object): id (``int``): Unique identifier for this user or bot. + is_self(``bool``): + True, if this user is you yourself. + + is_contact(``bool``): + True, if this user is in your contacts. + + is_mutual_contact(``bool``): + True, if you both have each other's contact. + + is_deleted(``bool``): + True, if this user is deleted. + is_bot (``bool``): True, if this user is a bot. @@ -53,6 +65,10 @@ class User(Object): def __init__( self, id: int, + is_self: bool, + is_contact: bool, + is_mutual_contact: bool, + is_deleted: bool, is_bot: bool, first_name: str, last_name: str = None, @@ -62,6 +78,10 @@ class User(Object): photo=None ): self.id = id + self.is_self = is_self + self.is_contact = is_contact + self.is_mutual_contact = is_mutual_contact + self.is_deleted = is_deleted self.is_bot = is_bot self.first_name = first_name self.last_name = last_name