diff --git a/Joining-a-public-channel.md b/Joining-a-public-channel.md new file mode 100644 index 0000000..9bc3d88 --- /dev/null +++ b/Joining-a-public-channel.md @@ -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). \ No newline at end of file