From 91b6885a93ee820e58aa3f852c00dfae6d4d22d8 Mon Sep 17 00:00:00 2001 From: Lonami Date: Fri, 9 Jun 2017 16:49:54 +0200 Subject: [PATCH] Created Joining a public channel (markdown) --- Joining-a-public-channel.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Joining-a-public-channel.md 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