A lightweight command-line toolkit to manage your Telegram account using the official Telegram API.
| Tool | Description |
|---|---|
| List Dialogs | Lists all your chats, channels, supergroups, and bots with their IDs and usernames |
| Delete by Keyword | Permanently deletes all YOUR messages containing a specific keyword across every chat |
- Python 3.7+
- A Telegram account
- API credentials from my.telegram.org
1. Clone or download the repository:
git clone https://github.com/yourname/TTools.git
cd TTools2. Install the package:
pip install .Run from anywhere in your terminal:
TToolsYou will see the main menu:
==================================================
🛠️ TTools — Telegram Toolkit
==================================================
[1] List Chats, Channels & Bots
[2] Delete Messages by Keyword
[q] Quit
Select a tool:
On the very first run, TTools will ask for your Telegram API credentials:
🔐 Enter your Telegram API credentials
Get them from: https://my.telegram.org
==================================================
API ID: xxxxxxxxx
API HASH: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
How to get your credentials:
- Go to https://my.telegram.org
- Log in with your phone number
- Go to API development tools
- Create an app and copy your
API IDandAPI Hash
Credentials are saved to ~/.ttools_config.json and reused automatically on every future run.
Your login session is stored at ~/.ttools_session — you will only need to enter your phone number and verification code once.
Fetches all your Telegram dialogs and prints them grouped by type:
==================================================
💬 Chats id :
==================================================
👤 John Doe | @johndoe | ID: 123456789
👥 Dev Team | N/A | ID: -987654321
🔷 Supergroup Name | @supergroupname | ID: -1001234567
__________________________________________________
📢 Channels id :
==================================================
📣 Tech News | @technews | ID: -1009876543
__________________________________________________
🤖 Bots :
==================================================
🤖 My Bot | @mybot | ID: 111222333
Searches through every chat for messages YOU sent that contain a specific keyword, then deletes them permanently.
🔑 Enter the keyword to search and delete: hello
⚠️ WARNING: All YOUR messages containing "hello" will be permanently deleted.
Type YES to confirm: YES
🔍 Searching for: "hello"
==================================================
📂 John Doe — Found 3 message(s)
✅ Deleted: "hello there, how are you?"
✅ Deleted: "hello!"
✅ Deleted: "hello, can we talk?"
→ 3 deleted, 0 failed
📂 Dev Team — Found 1 message(s)
✅ Deleted: "hello everyone"
→ 1 deleted, 0 failed
==================================================
✅ Done! Total deleted: 4 | Failed: 0
Note: In groups where you are not an admin, some older messages may not be deletable. These will be reported as failed with a permission error.
TTools/
├── setup.py
├── README.md
└── ttools/
├── __init__.py
├── bin/
│ ├── __init__.py
│ └── TTools.py # CLI entry point — main menu
└── lib/
├── __init__.py
├── config.py # Shared credential & session manager
├── id_list.py # Tool 1: List all dialogs
└── delete_keywords.py # Tool 2: Delete messages by keyword
To log out and clear all saved data:
rm ~/.ttools_config.json ~/.ttools_session*Next time you run TTools, it will ask for your credentials again from scratch.
TTools only operates on your own account and your own messages. It does not access, read, or modify any other user's data. Use responsibly and in accordance with Telegram's Terms of Service.