Created Joining a public channel (markdown)

Lonami 2017-06-09 16:49:54 +02:00
parent f0e568521d
commit 91b6885a93

@ -0,0 +1,15 @@
Once you have the [entity](Retrieving-an-entity) of the channel you want to join to, you can make use of the [`JoinChannelRequest`](https://lonamiwebs.github.io/Telethon/methods/channels/join_channel.html) to join such channel:
```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))
# In the same way, you can also leave such channel
from telethon.tl.functions.channels import LeaveChannelRequest
client.invoke(LeaveChannelRequest(input_channel))
```
For more on channels, check the [`channels` namespace](https://lonamiwebs.github.io/Telethon/methods/channels/index.html).