GetContactsRequest

Lonami 2017-07-09 12:49:12 +02:00
parent 9292ddd633
commit f557bbc004

@ -4,7 +4,7 @@ An "entity" is used to refer to either an [`User`](https://lonamiwebs.github.io/
```python ```python
from telethon.tl.functions.contacts import ResolveUsernameRequest from telethon.tl.functions.contacts import ResolveUsernameRequest
result = client.invoke(ResolveUsernameRequest('username')) result = client(ResolveUsernameRequest('username'))
found_chats = result.chats found_chats = result.chats
found_users = result.users found_users = result.users
# result.peer may be a PeerUser, PeerChat or PeerChannel # result.peer may be a PeerUser, PeerChat or PeerChannel
@ -34,7 +34,9 @@ from telethon.tl.types.contacts import Contacts
# `.sign_in()´ returns your User, otherwise use: # `.sign_in()´ returns your User, otherwise use:
self_user = client.get_me() self_user = client.get_me()
contacts = client.invoke(GetContactsRequest(self_user.access_hash))
# Even an empty hash for GetContactsRequest seems to work
contacts = client(GetContactsRequest(self_user.access_hash))
if isinstance(contacts, Contacts): if isinstance(contacts, Contacts):
users = contacts.users users = contacts.users
contacts = contacts.contacts contacts = contacts.contacts