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.sync import TelegramClient | |
from telethon.tl.functions.messages import GetDialogsRequest | |
from telethon.tl.types import InputPeerEmpty | |
# Go to https://my.telegram.org/apps, sign in, go to API development tools, create an app, copy and paste below: | |
api_id = 123456 | |
api_hash = '303xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' | |
phone = '+xxxxxxxxxxxx' | |
client = TelegramClient(phone, api_id, api_hash) | |
client.connect() | |
if not client.is_user_authorized(): |