Skip to content

Instantly share code, notes, and snippets.

@femdiya
femdiya / dellacc.py
Created August 2, 2025 15:24
Telethon script to delete user's account.
from telethon.sync import TelegramClient
from telethon.tl.functions.account import DeleteAccountRequest
api_id = 123456 # Replace with your API ID.
api_hash = 'xxxxxx' # Replace with your API Hash.
with TelegramClient('delete_me', api_id, api_hash) as client:
try:
client(DeleteAccountRequest(
reason='User requested account deletion'
@femdiya
femdiya / delall.py
Last active July 28, 2025 02:39
Telethon script to delete all messages from a certain channel/group/user.
from telethon import TelegramClient
from telethon.tl.types import PeerChannel
import asyncio
api_id = xxxxxx # Replace with your API ID.
api_hash = 'your_api_hash' # Replace with your API Hash.
getting_entity_ID = 'publicgroupusername/publicchannelusername' # No @ symbol, enter username only.
client = TelegramClient('session_name', api_id, api_hash)