tgsweep
English · Русский
Recorded on a made-up account, pauses shortened.
Deletes your messages, comments on posts and reactions in the Telegram groups you select. Runs on your computer: macOS, Windows or Linux. No server or bot needed.
Step-by-step guide for Windows, macOS and Linux: https://tgsweep.atworks.dev/en/
What tgsweep never does:
- never opens private chats, bots, Saved Messages or the Telegram service chat;
- never touches other people's messages, even if you are a group admin;
- never touches groups you created or your posts in channels;
- deletes nothing until you select chats and confirm.
Installation
You need uv, a manager for Python programs. It installs Python by itself.
macOS and Linux, in Terminal:
curl -LsSf https://astral.sh/uv/install.sh | sh
Windows, in PowerShell:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Then make uv available in the current window (or just open a new terminal):
macOS and Linux:
source $HOME/.local/bin/env
Windows, in PowerShell:
$env:Path = "$HOME\.local\bin;$env:Path"
Now install tgsweep:
uv tool install tgsweep
uv downloads the program from PyPI, the public catalog of Python programs, together with everything it needs.
Update
One command downloads and installs the latest version:
uv tool upgrade tgsweep
If you installed tgsweep earlier from the GitHub archive link, switch to the PyPI version once:
uv tool install --force tgsweep
api_id and api_hash
Third-party Telegram programs need their own key. It is free:
- Open https://my.telegram.org and sign in with your phone number. The code comes to Telegram.
- Choose API development tools and create an application. Any title and URL will do, platform Desktop.
- On the first run tgsweep asks for App api_id and App api_hash. The api_hash stays hidden as you type.
They are saved only on your computer.
Usage
tgsweep
- Sign in with a QR code: on your phone, Telegram > Settings > Devices > Link Desktop Device. If you have Two-Step Verification on, tgsweep asks for that password. If scanning does not work, sign in with a code:
tgsweep --code. - Choose which messages to delete: all, including today's, or older than 1, 2, 7 or 30 days.
- tgsweep finds your messages in groups and your comments on channel posts. In large chats the search takes a few minutes, and the bottom line shows which chat it is checking and how much time has passed. The next search is faster: tgsweep remembers the chats where none of your reactions were found and reads only new messages there.
- Select chats with Space and press Enter. At first nothing is selected.
- Type the number tgsweep shows: that many messages and reactions will be deleted. They cannot be restored.
- Everything selected is deleted in one go, with pauses so that Telegram does not limit your account. The bottom line shows how much is deleted already. If Telegram asks to wait, tgsweep waits and says so. Ctrl+C stops after the current request, and the rest will be found on the next run.
- At the end tgsweep offers to sign out on this computer. It is safer: the session file opens your whole account.
To sign out later: tgsweep --logout. You can also end the session in Telegram itself: Settings > Devices > the tgsweep session > Terminate Session.
The program uses your system language: Russian on a Russian system, English otherwise. To set it manually: tgsweep --lang en or --lang ru, the choice is remembered; back to automatic: --lang auto. The TGSWEEP_LANG variable (ru, en or auto) overrides the saved choice.
Where the files are
| System | Folder |
|---|---|
| macOS | ~/Library/Application Support/tgsweep |
| Windows | %LOCALAPPDATA%\tgsweep |
| Linux | ~/.local/share/tgsweep |
It holds the session file (tgsweep.session), the api_id and api_hash (credentials.json), settings.json with the chosen language if you changed it, and the deletion log logs/actions.jsonl: chat and message numbers, no texts. You can set another folder with the TGSWEEP_HOME variable.
Uninstall
tgsweep --logout
uv tool uninstall tgsweep
Then delete the folder from the table above.
License
MIT
Metadata
Release files for tgsweep 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tgsweep-0.3.0.tar.gz | 40.5 kB | With provenance | Details for tgsweep-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tgsweep-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for tgsweep-0.3.0-py3-none-any.whl |
Total release size: 85.2 kB
Release files / tgsweep-0.3.0.tar.gz
| Download URL | tgsweep-0.3.0.tar.gz |
|---|---|
| Size | 40.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6a5ad4f7726ac88cb2bfa318bf15741052ea6619f8bc64002b6bbb2359d8ba3
|
|
BLAKE2b-256 checksum How to use checksums |
84e989888f85f82f01734727e89966c043b988ccc4c432c0fb0714a451e2ee51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / tgsweep-0.3.0-py3-none-any.whl
| Download URL | tgsweep-0.3.0-py3-none-any.whl |
|---|---|
| Size | 44.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dfdbc03ca0657c254b77af23f6e73ae35f07eb1cc7998003be27bdbfd72bc166
|
|
BLAKE2b-256 checksum How to use checksums |
a85dd066e3b5ad1d06fbfad64cf060a328fdbea128c63d310255da2fba36a917
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logSecurity for tgsweep 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for tgsweep-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.