mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 01:16:35 +03:00
Created Joining a public channel (markdown)
parent
f0e568521d
commit
91b6885a93
15
Joining-a-public-channel.md
Normal file
15
Joining-a-public-channel.md
Normal file
|
@ -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).
|
Loading…
Reference in New Issue
Block a user