diff --git a/Joining-a-chat-or-channel.md b/Joining-a-chat-or-channel.md index ce819d2..3c01a00 100644 --- a/Joining-a-chat-or-channel.md +++ b/Joining-a-chat-or-channel.md @@ -26,4 +26,19 @@ If all you have is a link like this one: `https://t.me/joinchat/AAAAAFFszQPyPEZ7 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 +)) ``` \ No newline at end of file