2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-27 20:37:54 +00:00

Add extra attributes to User

is_self, is_contact, is_mutual_contact and is_deleted
This commit is contained in:
Dan 2018-07-12 00:54:13 +02:00
parent 8289dff05f
commit 1e727fbb43
2 changed files with 24 additions and 0 deletions

View File

@ -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,

View File

@ -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