Skip to content

Instantly share code, notes, and snippets.

View zodwick's full-sized avatar
🎯
Focusing

Anand zodwick

🎯
Focusing
View GitHub Profile
@zodwick
zodwick / telegram_cleanup.py
Created January 4, 2024 14:18
Leave unwanted/spam Telegram Groups - also delete joined Telegram messages chats
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():