Skip to main content

A library for captcha generator for Telegram bots

Project description

Captcha Generator




About Project

The project is designed for Capchaga's telegram robot to make it easier to authenticate users.
Of course you can use this project elsewhere and this project is not just for telegram robots.



Install


You Can Get Project From pip use this command :

pip install CaptchaGenerator

After if you using windows go to files project open fonts folder and install all fonts.


How To Work?

Temporarily in this version of the project (1.1.3) there is only CaptchaGenerator function for captcha generator. This function has 7 inputs:

  • NumberGen
  • ValuesCaptcha (optional)
  • NameExport (optional)
  • PathExport
  • Fonts (optional)
  • Colors (optional)
  • BackgroundS (optional)

Example :

from CaptchaGenerator.CaptchaGenerator import CaptchaGenerat
def main():
    NumberGen = 5
    NameExport = "CaptchaGenerat"  
    ValuesCaptcha = "012356789QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm!@#$%&*"  
    PathExport = r"C:\Users\sepeh\Desktop\Captcha Generator" 
    Fonts = ['AmaticSC-Bold.ttf', 'AmaticSC-Regular.ttf', 'ArchitectsDaughter-Regular.ttf']
    Colors = ["red" , "blue"] 
    BackgroundS = ["Background/Background1.png", "Background/Background2.png", "Background/Background3.png"] 
    choiceFromValues = CaptchaGenerat(NumberGen=NumberGen, ValuesCaptcha=ValuesCaptcha, NameExport=NameExport, PathExport=PathExport, Fonts=Fonts, Colors=Colors, BackgroundS=BackgroundS)
    print("Generated captcha : " + choiceFromValues)
if __name__ == "__main__":
    main()

Output Console :

Generated captcha : v*8X$

Output Image : Example Image

Example In Telegram (Pyrogram) :


from pyrogram import Client
from pyrogram.types import Message
from CaptchaGenerator.CaptchaGenerator import CaptchaGenerat
import pyromod

app = Client(
    'app', 
    api_id=123, # API ID
    api_hash="", # API HASH
    bot_token="" # BOT Token
)
@app.on_message()
async def start(client : Client , message : Message):
    if message.text == "/start":
        await message.reply_text("Welcome to my bot")
        choiceFromValues = CaptchaGenerat(NumberGen=5 , NameExport="TelegramCaptcha" ,PathExport=r"c:\path\Captcha Generator")
        await message.reply_photo(photo=r"c:\path\TelegramCaptcha.png")
        Captcha = await message.chat.ask("For use a bot send captcha :")
        if Captcha.text == choiceFromValues:
            await message.reply_text("Captcha it's true\nWelcome To Bot")
        else:
            await message.reply_text("Capcha is not right\nTry Again /start")
app.run()

Example Image

By Sepehr0Day

update in coming...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

CaptchaGenerator-1.1.3.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

CaptchaGenerator-1.1.3-py3-none-any.whl (4.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page