# TgEraser
[![PyPI version](https://badge.fury.io/py/tgeraser.svg)](https://badge.fury.io/py/tgeraser)
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](https://my.telegram.org/auth?to=apps).
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:
```json
{
"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.
Raw data
{
"_id": null,
"home_page": "https://github.com/en9inerd/tgeraser",
"name": "tgeraser",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.8",
"maintainer_email": null,
"keywords": "telegram, api, delete messages",
"author": "Vladimir Loskutov",
"author_email": "vladimir@enginerd.io",
"download_url": "https://files.pythonhosted.org/packages/29/f0/fa470463dc3b3584aab48c9f4aaf440f0bc03c766aacffcf24102bfef0cd/tgeraser-1.3.3.tar.gz",
"platform": null,
"description": "# TgEraser\n\n[![PyPI version](https://badge.fury.io/py/tgeraser.svg)](https://badge.fury.io/py/tgeraser)\n\nTgEraser 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.\n\n## Installation\n\n```\npip install tgeraser\ntgeraser\n```\n\nTo use TgEraser, you'll need to provide `api_id` and `api_hash`, which you can obtain from [here](https://my.telegram.org/auth?to=apps).\n\nThere are two methods to define `api_id` and `api_hash`:\n1. Set them as environment variables (`TG_API_ID` and `TG_API_HASH`).\n2. 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/`).\nCredentials file can be created/edited manually in the following format:\n```json\n{\n \"api_id\": 111111,\n \"api_hash\": \"abcdef1234567890abcdef1234567890\"\n}\n```\n\n## Usage\n\n```\nTgEraser deletes all your messages from a chat, channel, or conversation on Telegram without requiring admin privileges.\n\nUsage:\n tgeraser [(session <session_name>) --entity-type TYPE -l NUM [-d PATH] -p PEER_ID -o STRING] | [-k]\n tgeraser session <session_name> -p PEER_ID -t STRING [-o STRING]\n tgeraser session <session_name> -w [--entity-type TYPE -o STRING]\n tgeraser -h | --help\n tgeraser --version\n\nOptions:\n -d --directory PATH Specify a directory where your sessions are stored. [default: ~/.tgeraser/]\n -w --wipe-everything Delete all messages from all entities of a certain type that you have in your dialog list.\n --entity-type TYPE Available types: any, chat, channel, user. [default: chat]\n -p --peers PEER_ID Specify certain peers by comma (chat/channel/user).\n -l --limit NUM Show a specified number of recent chats.\n -t --time-period STRING Specify a period for an infinite loop to run messages deletion every X seconds/minutes/hours/days/weeks.\n Example: --time-period \"3*days\" OR --time-period \"5*seconds\"\n -o --older-than STRING Delete messages older than X seconds/minutes/hours/days/weeks.\n Example: --older-than \"3*days\" OR --older-than \"5*seconds\"\n -k --kill Terminate existing background TgEraser processes (only for Unix-like OS).\n -h --help Show this screen.\n --version Show version.\n```\n\nExecuting 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.\n\n## Contributing\n\nIf you have any issues or suggestions, please feel free to open an issue or submit a pull request.\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Tool deletes all your messages from chat/channel/conversation on Telegram.",
"version": "1.3.3",
"project_urls": {
"Homepage": "https://github.com/en9inerd/tgeraser"
},
"split_keywords": [
"telegram",
" api",
" delete messages"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6d2ab7703cd7959d7d0685e695e6c49f4bf3cd760f5f91ab545cfe350a9491ee",
"md5": "8d5942ac9832c8fe475c032baa0d01bc",
"sha256": "a0551b995b0bc02d5cd9d8022c7e08cb069969eb2efa43d1441eea1936cda494"
},
"downloads": -1,
"filename": "tgeraser-1.3.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8d5942ac9832c8fe475c032baa0d01bc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.8",
"size": 10317,
"upload_time": "2024-10-08T04:18:03",
"upload_time_iso_8601": "2024-10-08T04:18:03.057813Z",
"url": "https://files.pythonhosted.org/packages/6d/2a/b7703cd7959d7d0685e695e6c49f4bf3cd760f5f91ab545cfe350a9491ee/tgeraser-1.3.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "29f0fa470463dc3b3584aab48c9f4aaf440f0bc03c766aacffcf24102bfef0cd",
"md5": "92752fbb57aac37f32e6914658c48682",
"sha256": "3f297397a2c222c4959f3a61e131f24bb568f9109a8a2fc62676e11bb1ca8f49"
},
"downloads": -1,
"filename": "tgeraser-1.3.3.tar.gz",
"has_sig": false,
"md5_digest": "92752fbb57aac37f32e6914658c48682",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.8",
"size": 9432,
"upload_time": "2024-10-08T04:18:04",
"upload_time_iso_8601": "2024-10-08T04:18:04.539426Z",
"url": "https://files.pythonhosted.org/packages/29/f0/fa470463dc3b3584aab48c9f4aaf440f0bc03c766aacffcf24102bfef0cd/tgeraser-1.3.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-08 04:18:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "en9inerd",
"github_project": "tgeraser",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "docopt",
"specs": [
[
"==",
"0.6.2"
]
]
},
{
"name": "pyaes",
"specs": [
[
"==",
"1.6.1"
]
]
},
{
"name": "pyasn1",
"specs": [
[
"==",
"0.6.1"
]
]
},
{
"name": "rsa",
"specs": [
[
"==",
"4.9"
]
]
},
{
"name": "telethon",
"specs": [
[
"==",
"1.37.0"
]
]
}
],
"lcname": "tgeraser"
}