Simple telegram bot example written using aiogram with captcha to stop spam.
To use this example set .env
file with:
BOT_TOKEN
set to token given to the bot by @BotFather
For this example bot uses MemoryStorage which is not recommended for use in production
Learn more about storages in aiogram
In const.py file you can find a few options to configure this bot
IMAGES
list of images listed inIMAGES_ROUTE
folder. Images need to be facing right and should have transparent background.IMAGES_ROUTE
route to the folder with images.WIDTH
&HEIGHT
width and height of the captcha imageBACKGROUND
color of the captcha backgroundX_OFFSET
&Y_OFFSET
offset in which captcha can't be putROTATE_OFFSET
random rotation adjustments byn
degreesDELAY
time after which user is allowed to send next message in secondsOPTIONS
tuple of options user will be given after captcha is triggered. First in a tuple is a caption and second positions is meant for degrees orNone
which will be skipped
Currently this captcha is being used by @paces_bot
- aiogram 3.13.1
- python 3.11.8 (recommended)