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.

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] | [-k]
    tgeraser session <session_name> -p PEER_ID -t STRING [-o STRING]
    tgeraser session <session_name> -w [--entity-type TYPE -o STRING]
    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.
    --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.
    -t --time-period STRING     Specify a period for an infinite loop to run messages deletion every X seconds/minutes/hours/days/weeks.
                                Example: --time-period "3*days" OR --time-period "5*seconds"
    -o --older-than STRING      Delete messages older than X seconds/minutes/hours/days/weeks.
                                Example: --older-than "3*days" OR --older-than "5*seconds"
    -k --kill                   Terminate existing background TgEraser processes (only for Unix-like OS).
    -h --help                   Show this screen.
    --version                   Show version.

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.3.3.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

tgeraser-1.3.3-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tgeraser-1.3.3.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for tgeraser-1.3.3.tar.gz
Algorithm Hash digest
SHA256 3f297397a2c222c4959f3a61e131f24bb568f9109a8a2fc62676e11bb1ca8f49
MD5 92752fbb57aac37f32e6914658c48682
BLAKE2b-256 29f0fa470463dc3b3584aab48c9f4aaf440f0bc03c766aacffcf24102bfef0cd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tgeraser-1.3.3-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for tgeraser-1.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a0551b995b0bc02d5cd9d8022c7e08cb069969eb2efa43d1441eea1936cda494
MD5 8d5942ac9832c8fe475c032baa0d01bc
BLAKE2b-256 6d2ab7703cd7959d7d0685e695e6c49f4bf3cd760f5f91ab545cfe350a9491ee

See more details on using hashes here.

Supported by

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