mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-13 04:56:35 +03:00
Let get_input_peer do its magic
parent
862f63e39c
commit
3623496fb9
|
@ -6,10 +6,7 @@ Once you have the [entity](Retrieving-an-entity) of the channel you want to join
|
|||
|
||||
```python
|
||||
from telethon.tl.functions.channels import JoinChannelRequest
|
||||
from telethon.helpers import get_input_peer
|
||||
|
||||
input_channel = get_input_peer(channel)
|
||||
client.invoke(JoinChannelRequest(input_channel))
|
||||
client.invoke(JoinChannelRequest(channel))
|
||||
|
||||
# In the same way, you can also leave such channel
|
||||
from telethon.tl.functions.channels import LeaveChannelRequest
|
||||
|
@ -24,7 +21,6 @@ If all you have is a link like this one: `https://t.me/joinchat/AAAAAFFszQPyPEZ7
|
|||
|
||||
```python
|
||||
from telethon.tl.functions.messages import ImportChatInviteRequest
|
||||
|
||||
updates = client.invoke(ImportChatInviteRequest('AAAAAEHbEkejzxUjAUCfYg'))
|
||||
```
|
||||
|
||||
|
@ -34,11 +30,10 @@ If you don't want to add yourself, maybe because you're already in, you can alwa
|
|||
|
||||
```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),
|
||||
user_to_add,
|
||||
fwd_limit=10 # allow the user to see the 10 last messages
|
||||
))
|
||||
```
|
Loading…
Reference in New Issue
Block a user