mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 12:51:18 +00:00
Add vCard support for contacts
This commit is contained in:
parent
b6a4dee787
commit
f242aceb31
@ -360,6 +360,7 @@ def parse_messages(
|
||||
phone_number=media.phone_number,
|
||||
first_name=media.first_name,
|
||||
last_name=media.last_name or None,
|
||||
vcard=media.vcard or None,
|
||||
user_id=media.user_id or None
|
||||
)
|
||||
elif isinstance(media, types.MessageMediaVenue):
|
||||
|
@ -26,6 +26,7 @@ class SendContact(BaseClient):
|
||||
phone_number: str,
|
||||
first_name: str,
|
||||
last_name: str = "",
|
||||
vcard: str = "",
|
||||
disable_notification: bool = None,
|
||||
reply_to_message_id: int = None,
|
||||
reply_markup=None):
|
||||
@ -47,6 +48,9 @@ class SendContact(BaseClient):
|
||||
last_name (``str``, *optional*):
|
||||
Contact's last name.
|
||||
|
||||
vcard (``str``, *optional*):
|
||||
Contact's vCard information.
|
||||
|
||||
disable_notification (``bool``, *optional*):
|
||||
Sends the message silently.
|
||||
Users will receive a notification with no sound.
|
||||
@ -68,9 +72,10 @@ class SendContact(BaseClient):
|
||||
functions.messages.SendMedia(
|
||||
peer=self.resolve_peer(chat_id),
|
||||
media=types.InputMediaContact(
|
||||
phone_number,
|
||||
first_name,
|
||||
last_name
|
||||
phone_number=phone_number,
|
||||
first_name=first_name,
|
||||
last_name=last_name,
|
||||
vcard=vcard
|
||||
),
|
||||
message="",
|
||||
silent=disable_notification or None,
|
||||
|
@ -38,8 +38,16 @@ class Contact(Object):
|
||||
|
||||
ID = 0xb0700011
|
||||
|
||||
def __init__(self, phone_number: str, first_name: str, last_name: str = None, user_id=None):
|
||||
self.phone_number = phone_number # string
|
||||
self.first_name = first_name # string
|
||||
self.last_name = last_name # flags.0?string
|
||||
self.user_id = user_id # flags.1?int
|
||||
def __init__(
|
||||
self,
|
||||
phone_number: str,
|
||||
first_name: str,
|
||||
last_name: str = None,
|
||||
vcard: str = None,
|
||||
user_id: int = None
|
||||
):
|
||||
self.phone_number = phone_number
|
||||
self.first_name = first_name
|
||||
self.last_name = last_name
|
||||
self.vcard = vcard
|
||||
self.user_id = user_id
|
||||
|
Loading…
Reference in New Issue
Block a user