Telegram bot that sends reCAPTCHA styled image when someone joins a chat.
At first you need to create the images
directory. In it create other directories with images that have the same theme. The name of each directory will be used as captcha image caption.
Then rename settings.json.dist
to settings.json
and fill the values in it. More on this below in Settings File section.
After that you will be able to run it with Docker.
docker compose up -d --build
In Telegram add the bot to your chat (also make sure that chats_id
array in settings file has its ID or that it's empty) and promote it to admin.
If you want to get some captcha images, you can direct message the bot (your Telegram ID must be in owner_id
in settings file). It will send you all its commands on the /start
command.
All bot settings stored in settings.json
file.
token
- your bot token from BotFatherowner_id
- your Telegram IDchats_id
- chats where bot will work, leave the array empty to make the bot work in any chatinclude_directories
- directory names inimages
directory that will be used in the captcha, leave the array empty to use all directoriesexclude_directories
- directory names inimages
directory that won't be used in the captcha, leave the array empty to use all directoriesno_caption_directories
- directory names inimages
directory that will be used in the captcha, but won't be used as caption of it, leave the array empty to use all directorieskick_delay
- the number of seconds that must pass before the bot kicks the user, if it's0
, bot will never kick the usermessages_text
joined
- text used as caption of the captcha image message (allowed keys:username
,first_name
,full_name
,answers
)answer
- text used when user tried to solve the captcha (allowed keys:username
,first_name
,full_name
,correct
,incorrect
,congrats
)no_nums
- congrats when there is no numbers in the user answerno_text
- congrats when there is no text in the user answercorrect_<n>
- congrats when there is<n>
correct answersincorrect
- congrats when there is 4 correct and more than 2 incorrect answers
Some of message texts can be formatted with some keys:
username
- '@' symbol with user's usernamefirst_name
- user's first namefull_name
- user's first and last nameanswers
- list of correct captcha answerscorrect
- number of user correct answersincorrect
- number of user incorrect answerscongrats
- text based on number of correct and incorrect answers
For example this text:
some text... {username} | {first_name} | {full_name} | {answers} | {correct} | {incorrect} | {congrats}
will be formatted as:
some text... @dofoerix | Dofoerix | Dofoerix Second Name | 1, 4, 5, 9 | 3 | 1 | Not bad!
This bot uses Roboto font by Christian Robertson. It's licensed under the Apache License, Version 2.0.
Bot itself is licensed under the MIT license.