Add AddChatUserRequest example

Lonami 2017-06-10 13:26:56 +02:00
parent 4a79c967dc
commit 95fa91576b

@ -27,3 +27,18 @@ from telethon.tl.functions.messages import ImportChatInviteRequest
updates = client.invoke(ImportChatInviteRequest('AAAAAEHbEkejzxUjAUCfYg'))
```
## Adding someone else to such chat or channel
If you don't want to add yourself, maybe because you're already in, you can always add someone else with the [`AddChatUserRequest`](https://lonamiwebs.github.io/Telethon/methods/messages/add_chat_user.html), which use is very straightforward:
```python
from telethon.tl.functions.messages import AddChatUserRequest
from telethon.helpers import get_input_peer
client.invoke(AddChatUserRequest(
chat_id,
get_input_peer(user_to_add),
fwd_limit=10 # allow the user to see the 10 last messages
))
```