Created
May 16, 2021 11:23
-
-
Save yusufpapurcu/64f7b43af8b46ea8b00814970bc5d60b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from telethon import TelegramClient | |
# These example values won't work. You must get your own api_id and | |
# api_hash from https://my.telegram.org, under API Development. | |
api_id = 12345 | |
api_hash = '0123456789abcdef0123456789abcdef' | |
client = TelegramClient('anon.session', api_id, api_hash) # You need run twice because this part create session in first run. | |
client.start() | |
for chat in client.iter_dialogs(): | |
print(chat.name," --- ", chat.id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment