mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 13:27:47 +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,
|
phone_number=media.phone_number,
|
||||||
first_name=media.first_name,
|
first_name=media.first_name,
|
||||||
last_name=media.last_name or None,
|
last_name=media.last_name or None,
|
||||||
|
vcard=media.vcard or None,
|
||||||
user_id=media.user_id or None
|
user_id=media.user_id or None
|
||||||
)
|
)
|
||||||
elif isinstance(media, types.MessageMediaVenue):
|
elif isinstance(media, types.MessageMediaVenue):
|
||||||
|
@ -26,6 +26,7 @@ class SendContact(BaseClient):
|
|||||||
phone_number: str,
|
phone_number: str,
|
||||||
first_name: str,
|
first_name: str,
|
||||||
last_name: str = "",
|
last_name: str = "",
|
||||||
|
vcard: str = "",
|
||||||
disable_notification: bool = None,
|
disable_notification: bool = None,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup=None):
|
reply_markup=None):
|
||||||
@ -47,6 +48,9 @@ class SendContact(BaseClient):
|
|||||||
last_name (``str``, *optional*):
|
last_name (``str``, *optional*):
|
||||||
Contact's last name.
|
Contact's last name.
|
||||||
|
|
||||||
|
vcard (``str``, *optional*):
|
||||||
|
Contact's vCard information.
|
||||||
|
|
||||||
disable_notification (``bool``, *optional*):
|
disable_notification (``bool``, *optional*):
|
||||||
Sends the message silently.
|
Sends the message silently.
|
||||||
Users will receive a notification with no sound.
|
Users will receive a notification with no sound.
|
||||||
@ -68,9 +72,10 @@ class SendContact(BaseClient):
|
|||||||
functions.messages.SendMedia(
|
functions.messages.SendMedia(
|
||||||
peer=self.resolve_peer(chat_id),
|
peer=self.resolve_peer(chat_id),
|
||||||
media=types.InputMediaContact(
|
media=types.InputMediaContact(
|
||||||
phone_number,
|
phone_number=phone_number,
|
||||||
first_name,
|
first_name=first_name,
|
||||||
last_name
|
last_name=last_name,
|
||||||
|
vcard=vcard
|
||||||
),
|
),
|
||||||
message="",
|
message="",
|
||||||
silent=disable_notification or None,
|
silent=disable_notification or None,
|
||||||
|
@ -38,8 +38,16 @@ class Contact(Object):
|
|||||||
|
|
||||||
ID = 0xb0700011
|
ID = 0xb0700011
|
||||||
|
|
||||||
def __init__(self, phone_number: str, first_name: str, last_name: str = None, user_id=None):
|
def __init__(
|
||||||
self.phone_number = phone_number # string
|
self,
|
||||||
self.first_name = first_name # string
|
phone_number: str,
|
||||||
self.last_name = last_name # flags.0?string
|
first_name: str,
|
||||||
self.user_id = user_id # flags.1?int
|
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…
x
Reference in New Issue
Block a user