Telegram Anti-Spam Bot with Text-Based CAPTCHA
Having used Telegram for so long, the anti-spam bots I've seen all use button selection to answer questions, which in theory could be vulnerable to brute-forcing the entire question bank. If your group is attractive enough and there are enough spam bots wanting to join, they can always find the answer to the join question. And if the join question is too extreme (https://github.com/XTLS/Xray-core/discussions/3487) it instead ends up rejecting some less capable genuine humans (they have no intention of spamming; they just want to join to ask questions or chat)
So I came up with an idea: what if the bot-check question requires a text answer?
Let's get right to it, using Claude for the initial build.
I want to develop a Telegram bot like thisThe bot works in groupsWhen the bot detects a new member joining, the bot mutes the new member.The bot requires the new member to complete a human verification in a private chat with the bot.If the human verification is passed, the bot unmutes the new member.The specific process of the human verification is as followsWhen the new member sends /start to the bot, the bot asks a question, and the new member replies by entering text.
Put the obtained results into VS Code, and collaborate with M$ Copilot for debugging.
Effect
Github
The total line count (including blank lines and comments) is under 300 lines — pretty lightweight, isn't it!
* Considering there will be a few more installments of updates to come, the code for this installment has also been copied as tg-join-group-exam-bot1.py in the project.
See the project readme for deployment instructions
For now this is just the most basic skeleton; we'll refine it gradually in the future.
Welcome to follow my blog

