Skip to content

owl-sp/TTools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🛠️ TTools — Telegram Toolkit

A lightweight command-line toolkit to manage your Telegram account using the official Telegram API.


Features

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

Requirements


Installation

1. Clone or download the repository:

git clone https://github.com/yourname/TTools.git
cd TTools

2. Install the package:

pip install .

Usage

Run from anywhere in your terminal:

TTools

You will see the main menu:

==================================================
  🛠️   TTools — Telegram Toolkit
==================================================

  [1] List Chats, Channels & Bots
  [2] Delete Messages by Keyword
  [q] Quit

Select a tool:

First Run — API Credentials

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:

  1. Go to https://my.telegram.org
  2. Log in with your phone number
  3. Go to API development tools
  4. Create an app and copy your API ID and API 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.


Tool Details

[1] List Chats, Channels & Bots

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

[2] Delete Messages by Keyword

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.


Project Structure

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

Resetting Credentials

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.


Disclaimer

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.

About

Telegram tool kit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages