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:
parent
8289dff05f
commit
1e727fbb43
@ -129,6 +129,10 @@ def parse_chat_photo(photo):
|
|||||||
def parse_user(user: types.User) -> pyrogram_types.User or None:
|
def parse_user(user: types.User) -> pyrogram_types.User or None:
|
||||||
return pyrogram_types.User(
|
return pyrogram_types.User(
|
||||||
id=user.id,
|
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,
|
is_bot=user.bot,
|
||||||
first_name=user.first_name,
|
first_name=user.first_name,
|
||||||
last_name=user.last_name,
|
last_name=user.last_name,
|
||||||
|
@ -26,6 +26,18 @@ class User(Object):
|
|||||||
id (``int``):
|
id (``int``):
|
||||||
Unique identifier for this user or bot.
|
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``):
|
is_bot (``bool``):
|
||||||
True, if this user is a bot.
|
True, if this user is a bot.
|
||||||
|
|
||||||
@ -53,6 +65,10 @@ class User(Object):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
id: int,
|
id: int,
|
||||||
|
is_self: bool,
|
||||||
|
is_contact: bool,
|
||||||
|
is_mutual_contact: bool,
|
||||||
|
is_deleted: bool,
|
||||||
is_bot: bool,
|
is_bot: bool,
|
||||||
first_name: str,
|
first_name: str,
|
||||||
last_name: str = None,
|
last_name: str = None,
|
||||||
@ -62,6 +78,10 @@ class User(Object):
|
|||||||
photo=None
|
photo=None
|
||||||
):
|
):
|
||||||
self.id = id
|
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.is_bot = is_bot
|
||||||
self.first_name = first_name
|
self.first_name = first_name
|
||||||
self.last_name = last_name
|
self.last_name = last_name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user