Skip to main content

Tool deletes all your messages from chat/channel/conversation on Telegram.

Project description

TgEraser

PyPI version

TgEraser is a Python tool that allows you to delete all your messages from a chat, channel, or conversation on Telegram without requiring admin privileges. Official Telegram clients do not provide a one-click solution to delete all your messages; instead, you have to manually select and delete messages, with a limit of 100 messages per batch. TgEraser solves this problem and offers a convenient way to mass-delete your messages on Telegram.

Looking for a Go version? Check out go-tgeraser — a Go implementation of this tool with pre-built binaries available.

Installation

pip install tgeraser
tgeraser

To use TgEraser, you'll need to provide api_id and api_hash, which you can obtain from here.

There are two methods to define api_id and api_hash:

  1. Set them as environment variables (TG_API_ID and TG_API_HASH).
  2. Allow the tool to prompt you for input during first execution, with an option to save the credentials in a credentials.json file located in the same directory as the sessions (by default, ~/.tgeraser/). Credentials file can be created/edited manually in the following format:
{
    "api_id": 111111,
    "api_hash": "abcdef1234567890abcdef1234567890"
}

Usage

TgEraser deletes all your messages from a chat, channel, or conversation on Telegram without requiring admin privileges.

Usage:
    tgeraser [(session <session_name>) --entity-type TYPE -l NUM -d PATH -p PEER_ID -o STRING -m TYPES --delete-conversation]
    tgeraser session <session_name> -w [--entity-type TYPE -o STRING -m TYPES --delete-conversation]
    tgeraser -h | --help
    tgeraser --version

Options:
    -d --directory PATH         Specify a directory where your sessions are stored. [default: ~/.tgeraser/]
    -w --wipe-everything        Delete all messages from all entities of a certain type that you have in your dialog list.
    --delete-conversation       If set, delete the whole conversation (only valid for user-type peers).
    --entity-type TYPE          Available types: any, chat, channel, user. [default: chat]
    -p --peers PEER_ID          Specify certain peers by comma (chat/channel/user).
    -l --limit NUM              Show a specified number of recent chats.
    -o --older-than STRING      Delete messages older than X seconds/minutes/hours/days/weeks.
                                Example: --older-than "3*days" OR --older-than "5*seconds"
    -m --media-type TYPES       Delete only specific media types (server-side filtering).
                                Comma-separated list of: photo, video, audio, voice, video_note, gif, document.
                                Use "media" to delete all media types. If not specified, deletes all messages.
                                Example: --media-type "photo,video" OR --media-type media
    --proxy HOST:PORT:SECRET    MTProto proxy (e.g. 1.2.3.4:443:deadbeef).
    -h --help                   Show this screen.
    --version                   Show version.

MTProto proxy

Connect via an MTProto proxy (useful in regions where Telegram is blocked):

tgeraser --proxy 1.2.3.4:443:ee367f1d2b4c7e9a0f5d8b3c6a2e1f4d

The secret is the hex string provided by your MTProto proxy server.

Executing the tool without options will guide you through the creation of your first user session. After that you can create sessions for multiple users using the tgeraser session <new_session_name> command.

Contributing

If you have any issues or suggestions, please feel free to open an issue or submit a pull request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tgeraser-1.6.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tgeraser-1.6.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file tgeraser-1.6.0.tar.gz.

File metadata

  • Download URL: tgeraser-1.6.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tgeraser-1.6.0.tar.gz
Algorithm Hash digest
SHA256 adc5e1d2f731fb3495e1b24ddf2ec604b711658ceadf93e15f2fe57f00969b71
MD5 1012e5fc05de10aeb5b11ce100743715
BLAKE2b-256 8825bd0fc91e9737059bba0153078653e5478c2bc76ebb644b5e6b260fb5705f

See more details on using hashes here.

File details

Details for the file tgeraser-1.6.0-py3-none-any.whl.

File metadata

  • Download URL: tgeraser-1.6.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tgeraser-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5156f73af7eafdcc90d80ce7d2661a87cae49239c604036bd77eed3e6aee70bd
MD5 c9885af7c90b927603a854b11c591c15
BLAKE2b-256 167372c6d3febc11b32fd0f5e3bdd55eb58b412d4add7849755274fb927d71aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page