telethon get channel id

Solutions on MaxInterview for telethon get channel id by the best coders in the world

showing results for - "telethon get channel id"
Luca
04 Aug 2020
1# Dialogs are the "conversations you have open".
2# This method returns a list of Dialog, which
3# has the .entity attribute and other information.
4dialogs = client.get_dialogs()
5
6# All of these work and do the same.
7lonami = client.get_entity('lonami')
8lonami = client.get_entity('t.me/lonami')
9lonami = client.get_entity('https://telegram.dog/lonami')
10
11# Other kind of entities.
12channel = client.get_entity('telegram.me/joinchat/AAAAAEkk2WdoDrB4-Q8-gg')
13contact = client.get_entity('+34xxxxxxxxx')
14friend  = client.get_entity(friend_id)
15
16# Getting entities through their ID (User, Chat or Channel)
17entity = client.get_entity(some_id)
18
19# You can be more explicit about the type for said ID by wrapping
20# it inside a Peer instance. This is recommended but not necessary.
21from telethon.tl.types import PeerUser, PeerChat, PeerChannel
22
23my_user    = client.get_entity(PeerUser(some_id))
24my_chat    = client.get_entity(PeerChat(some_id))
25my_channel = client.get_entity(PeerChannel(some_id))