<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: umbrella-at</title>
    <description>The latest articles on DEV Community by umbrella-at (@umbrellaat).</description>
    <link>https://dev.to/umbrellaat</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4276533%2F35becc58-3dab-4901-b860-d8c871a00594.jpg</url>
      <title>DEV Community: umbrella-at</title>
      <link>https://dev.to/umbrellaat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/umbrellaat"/>
    <language>en</language>
    <item>
      <title>How I found and deleted 8,000 of my old Telegram group messages</title>
      <dc:creator>umbrella-at</dc:creator>
      <pubDate>Tue, 01 Dec 2026 13:28:10 +0000</pubDate>
      <link>https://dev.to/umbrellaat/how-i-found-and-deleted-8000-of-my-old-telegram-group-messages-2o1j</link>
      <guid>https://dev.to/umbrellaat/how-i-found-and-deleted-8000-of-my-old-telegram-group-messages-2o1j</guid>
      <description>&lt;p&gt;The first time I ran my own tool on my account, it found more than 8,000 of my messages in Telegram groups. I don't remember writing most of them. Anyone in those groups can still read every one.&lt;/p&gt;

&lt;p&gt;Telegram has no button to delete all your messages in a group, so I wrote tgsweep. It's a free, open-source command-line tool that finds your messages, comments on channel posts and reactions in Telegram groups, and deletes the ones you choose. This post covers who can read old group messages, why they are hard to remove by hand, and how the tool works through the Telegram API, including the part the API doesn't cover at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who can read your old messages
&lt;/h2&gt;

&lt;p&gt;The members, first of all. Group history is usually open to everyone who joins, including people who join years after you wrote something. If the admins haven't hidden the member list, searching by member pulls up everything one person has written in a couple of seconds. With a hidden member list you can only search for yourself and the admins, but not every group hides it.&lt;/p&gt;

&lt;p&gt;Then there are archives. Researchers have built an &lt;a href="https://arxiv.org/abs/2409.02525" rel="noopener noreferrer"&gt;open-source crawler&lt;/a&gt; that finds public groups through TGStat, joins them and collects all their messages into a long-running archive. Data marketplaces sell scrapers that export &lt;a href="https://apify.com/i-scraper/telegram-groups-scraper" rel="noopener noreferrer"&gt;the history of any group an account can access&lt;/a&gt;, for under a dollar per thousand messages. &lt;a href="https://apify.com/direct_duty/telegram-rag-scraper" rel="noopener noreferrer"&gt;Another listing&lt;/a&gt; offers each user's history as "a single, chronological text block of a user's recent messages".&lt;/p&gt;

&lt;p&gt;In Russia this has become a business. Lookup bots inside Telegram collect messages from open groups and sell a person's name history, list of groups and messages by their user ID. In February 2026 the Russian regulator Roskomnadzor &lt;a href="https://www.rbc.ru/technology_and_media/20/02/2026/699837899a7947bc15bec431" rel="noopener noreferrer"&gt;told RBC&lt;/a&gt; (in Russian) that Telegram had removed 8,358 such services since 2022, and that new ones appear every week.&lt;/p&gt;

&lt;p&gt;None of this expires. A message from 2019 stays in the group until someone deletes it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why not delete them by hand
&lt;/h2&gt;

&lt;p&gt;Telegram has no "delete all my messages here" button. You can select up to 100 messages, delete them and scroll further back. With dozens of groups and years of chat, that takes evenings. Comments under channel posts live in separate discussion groups that many people forget they're in. Your own reactions can't be searched at all, only found by scrolling.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use it
&lt;/h2&gt;

&lt;p&gt;tgsweep is free, MIT-licensed and runs in a terminal on macOS, Windows and Linux. On the first run it asks for an api_id and api_hash, a free key that Telegram gives out at my.telegram.org. You sign in with a QR code, the same way you link Telegram Desktop.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fumbrella-at%2Ftgsweep%2Fmain%2Fdocs%2Fmedia%2Fdemo-en.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fumbrella-at%2Ftgsweep%2Fmain%2Fdocs%2Fmedia%2Fdemo-en.gif" alt="tgsweep deleting messages in two selected Telegram groups" width="800" height="507"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Recorded on a made-up account, pauses shortened.&lt;/p&gt;

&lt;p&gt;Then there are three steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Choose what to delete: everything, or messages older than 1, 2, 7 or 30 days. "Older than 7 days" keeps the last week of conversation.&lt;/li&gt;
&lt;li&gt;Pick the chats. tgsweep lists the groups where it found your messages and how many messages and reactions each one holds.&lt;/li&gt;
&lt;li&gt;Confirm by typing the number tgsweep shows, so a stray Enter can't start the deletion.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;At the end it prints a report and writes a log. The log has no message texts, only where and how much was deleted.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;It's Python and Telethon. For messages, tgsweep lets Telegram do the searching: in each group it runs a chat search filtered by sender, so even large groups go quickly. It deletes in chunks of 100 with a pause between requests. When Telegram answers with FloodWait, tgsweep waits exactly as long as it was told and says so in the status line.&lt;/p&gt;

&lt;p&gt;Reactions are harder, because the API has no "find my reactions" request. tgsweep reads the chat history and checks each message's reactions: a reaction you chose has &lt;code&gt;chosen_order&lt;/code&gt; set. The catch is that Telegram sometimes returns reactions in a shared form, the same for every viewer, with the &lt;code&gt;min&lt;/code&gt; flag set and no mark of which one is yours. For those messages tgsweep asks for the full reactions separately, 100 messages per request. Simplified:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;telethon&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;functions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;GetMessagesReactionsRequest&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;telethon&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;types&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;UpdateMessageReactions&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;has_mine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;reactions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;reactions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chosen_order&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;reactions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;mine&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;need_full&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;msg&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;iter_messages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;offset_date&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;window_start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reverse&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;has_mine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reactions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;mine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reactions&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reactions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;min&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reactions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;need_full&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;need_full&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;GetMessagesReactionsRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;peer&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;need_full&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;upd&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;updates&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;upd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;UpdateMessageReactions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="nf"&gt;has_mine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;upd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reactions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;mine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;upd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;msg_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reading history is slow, so the reaction search covers the last 90 days. On the next run tgsweep reads only new messages in chats where it found none of your reactions.&lt;/p&gt;

&lt;p&gt;Comments on channel posts live in discussion groups linked to channels. tgsweep takes the channels from your chat list, gets each channel's linked group with &lt;code&gt;channels.getFullChannel&lt;/code&gt; and searches it the same way as any other group.&lt;/p&gt;

&lt;p&gt;Private chats and bots are never opened. Groups you created are skipped, so you can't empty your own group by accident. Other people's messages are never touched, even where you're an admin.&lt;/p&gt;

&lt;p&gt;The key, the session and the log stay on your computer. tgsweep has no server and no analytics, it talks only to Telegram. The PyPI package is built and published by a public GitHub Actions workflow through trusted publishing, so PyPI shows which repository and which run produced each release.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it won't do
&lt;/h2&gt;

&lt;p&gt;Copies that already exist stay where they are: bot archives, screenshots, a chat export on someone else's machine. tgsweep removes your messages from the groups themselves, so whoever searches later finds nothing. Run it once a week with "older than 7 days", and only recent conversation stays visible.&lt;/p&gt;

&lt;p&gt;Reactions older than 90 days are out of reach. And for some accounts the key form on my.telegram.org just answers ERROR; the &lt;a href="https://tgsweep.atworks.dev/en/#faq" rel="noopener noreferrer"&gt;FAQ&lt;/a&gt; explains what to try.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install
&lt;/h2&gt;

&lt;p&gt;macOS and Linux:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -LsSf https://astral.sh/uv/install.sh &lt;span class="o"&gt;|&lt;/span&gt; sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Windows, in PowerShell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;powershell&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;ExecutionPolicy&lt;/span&gt; &lt;span class="nc"&gt;ByPass&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="s2"&gt;"irm https://astral.sh/uv/install.ps1 | iex"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, in a new terminal window:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uv tool install tgsweep
tgsweep
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;uv is a manager for Python programs and installs Python by itself. Step-by-step guide for all three systems: &lt;a href="https://tgsweep.atworks.dev/en/" rel="noopener noreferrer"&gt;tgsweep.atworks.dev/en&lt;/a&gt;. Code: &lt;a href="https://github.com/umbrella-at/tgsweep" rel="noopener noreferrer"&gt;github.com/umbrella-at/tgsweep&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;tgsweep isn't the first tool for this. &lt;a href="https://github.com/gurland/telegram-delete-all-messages" rel="noopener noreferrer"&gt;telegram-delete-all-messages&lt;/a&gt;, &lt;a href="https://github.com/en9inerd/tgeraser" rel="noopener noreferrer"&gt;TgEraser&lt;/a&gt; and &lt;a href="https://github.com/rusq/wipemychat" rel="noopener noreferrer"&gt;wipemychat&lt;/a&gt; do similar jobs, and the README lists what tgsweep does differently.&lt;/p&gt;

&lt;p&gt;If something breaks or a feature is missing, open an issue on GitHub. And if you know a cheaper way to find your own reactions than reading the history, I'd like to hear it in the comments.&lt;/p&gt;

</description>
      <category>telegram</category>
      <category>python</category>
      <category>privacy</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
