My Telegram Anti-Advertising Bot Solution

I don't support pulling various external bots into groups, as this makes the information in the group easier to be scraped.

After granting these bots admin permissions, it's hard to guarantee that these bots won't do malicious things.
Does anyone still remember the incident of the bidirectional chatbot livegarm bot posting ads?

For anti-advertising, there are basically two approaches.
One is human verification.
The other is analyzing whether the message content is an advertisement.

There are many ways to do human verification. 
Answering questions, solving problems, using Cloudflare's human verification, etc...
The approach I chose is to reply to text. First, it's easy to customize. Second, it's easy to increase the difficulty of the questions.
If you want to have meaningful random questions, that's also possible. For example, what is the title of my latest blog post
Theoretically, human verification cannot solve the situation where real people are used to answer the questions. It all comes down to the game between the size of your group and the determination of the spammers.

Analyzing whether the message content is an advertisement is much more difficult.
Moreover, I think there's a trust issue involved, so I haven't implemented it.
There are quite a few people working on anti-advertising bots based on message content analysis. Many of them also provide free open access.
But I have some concerns,
1. What if this anti-advertising bot takes money from advertisers and  "intentionally" lets ads slip through? 
2. What if this anti-advertising bot relies on everyone providing information and feedback (ad messages, non-ad messages). 
Even if this anti-advertising bot itself is neutral. 
2a. If someone deliberately reports ad messages as normal messages, letting the anti-advertising bot learn and form judgment rules, and then uses the same pattern to send ad messages themselves, they can bypass the defense.
2b. If someone deliberately reports normal messages as fake ad messages, letting the anti-advertising bot learn and form judgment rules, it will cause false positives, deliberately making the anti-advertising bot perform poorly, so that group owners won't dare to use this bot.
3. If this advertising bot relies on the author or a small group to provide ad and non-ad data for training, then as the patterns of ad messages may change every day, this advertising judgment database also needs to be updated in a timely manner. This is an unimaginable amount of energy investment. If it were me, I wouldn't maintain such a project.

For a non-commercial project like this, started out of interest in spare time.
I'm considering designing it as 
big and perfect, or small and rough, 
all-in-one / powerful features  or  independent / flexible features / good enough,
I would choose the latter.

The earliest Telegram keyword monitoring bot I deployed in practice was someone else's project. 
That project designed the bot to automatically join groups, and designed different users to monitor different keywords in different groups. That project used a database. 
The total amount of code for that project is 1.3K

This year, with the help of GPT, I developed my own Telegram keyword monitoring bot
This project requires the user to manually complete the bot joining the group.
For all users, this project shares the same keyword list.
This project doesn't use a database; the keywords are saved in the configuration file.
For me personally, the usage effect of this project is exactly the same as the previous one.
The total amount of code for this project is 0.45K

My own Telegram anti-advertising solution is divided into 2 bots and 4 tools
Each bot has no more than 0.5K lines of code
Each tool has no more than 0.1K lines of code


==== update
2025-10-17
Anti-advertising bot forwarding ads in the group by itself

At this time, I went to the channel of this "anti-advertising bot" and saw this on 2025-10-16

And this on 2025-10-10


==== update
2025-10-24
These businesses that can monitor group messages are essentially those that have bots or accounts inside the group
Comments