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 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()
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)
Built Distribution
Close
Hashes for CaptchaGenerator-1.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f28069d293972bef95ea08a2007d1dbe188e97db0bdaaf7a38d942928de48d33 |
|
MD5 | c02aa3932df66e48ca312bee7684280b |
|
BLAKE2b-256 | 3dcbe277ba47334d1a6d454d09ce1f3095c4ce621ab9d84eb1ca3f3393a88846 |