You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromcaptchaimportCaptcha# You may define your own choices, which will be used in keyboard initializationmy_choices: Dict[str, str] = {
"cat": "🐈",
"human": "👨",
"banana": "🍌",
"monkey": "🐒",
}
# The module collects information about which users have passed the captcha. # This is necessary so that the captcha does not appear several times in a rowifmessage.from_user.idnotinCaptcha.captcha_passed_users:
captcha=Captcha(
choices=my_choices# You can also don't choose to specify your own choices. # In this case, the module's built-in choices will be used
)
keyboard=captcha.get_captcha_keyboard()
captcha.register_handlers(dp) # dp -> your dispatcher instanceawaitbot.send_message(
message.chat.id,
captcha.get_caption(), # This is necessary in order for the captcha description# to be generated automatically, since it is dynamicreply_markup=keyboard
)
return