mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 01:16:35 +03:00
Add AddChatUserRequest example
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
|
||||
))
|
||||
```
|
Loading…
Reference in New Issue
Block a user