Skip to main content

Ultra-fast Telegram bot framework with YouTube downloader, currency, Wikipedia PDF and QR code generation

Project description

โšก Zehnex Pro 1.0.1

Ultra-fast async Telegram bot framework โ€” YouTube yuklovchi, valyuta konvertor, Wikipediaโ†’PDF va QR kod generatori bilan.

pip install zehnex-pro

๐Ÿš€ Tez boshlash

from zehnex_pro import ZehnexBot, VideoDownloader, CurrencyConverter, WikiToPDF, QRGenerator, Filter

bot = ZehnexBot("YOUR_BOT_TOKEN")
dl = VideoDownloader()
currency = CurrencyConverter()
wiki = WikiToPDF(language="uz")
qr = QRGenerator()

# โ”€โ”€โ”€ /start โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
@bot.command("start", aliases=["help"])
async def start(ctx):
    await ctx.reply(
        "๐Ÿ‘‹ Salom! <b>Zehnex Pro Bot</b>\n\n"
        "๐Ÿ“น /video [URL] โ€” video yuklab berish\n"
        "๐ŸŽต /audio [URL] โ€” mp3 yuklab berish\n"
        "๐Ÿ’ฑ /convert 100 USD UZS โ€” valyuta\n"
        "๐Ÿ“– /wiki [mavzu] โ€” Wikipedia PDF\n"
        "๐Ÿ”ฒ /qr [matn/URL] โ€” QR kod\n"
        "๐Ÿ“ถ /wifi [ssid] [parol] โ€” WiFi QR"
    )

# โ”€โ”€โ”€ Video yuklovchi โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
@bot.command("video")
async def video_cmd(ctx):
    url = ctx.args[0] if ctx.args else VideoDownloader.extract_url(ctx.text)
    if not url:
        await ctx.reply("โŒ URL yuboring!\nMisol: /video https://youtube.com/watch?v=...")
        return

    await ctx.upload_video()
    try:
        info = await dl.get_info(url)
        await ctx.reply(f"โณ Yuklanmoqda...\n\n{info}")
        path = await dl.download(url, quality="720p")
        await ctx.send_video(path, caption=f"๐ŸŽฌ {info.title}")
        dl.cleanup(path)
    except Exception as e:
        await ctx.reply(f"โŒ Xato: {e}")

# โ”€โ”€โ”€ Audio (MP3) yuklovchi โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
@bot.command("audio")
async def audio_cmd(ctx):
    url = ctx.args[0] if ctx.args else None
    if not url:
        await ctx.reply("โŒ URL yuboring!")
        return
    await ctx.typing()
    path = await dl.download(url, audio_only=True)
    await ctx.send_document(path, caption="๐ŸŽต MP3 tayyor!")
    dl.cleanup(path)

# โ”€โ”€โ”€ Valyuta konvertatsiya โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
@bot.command("convert")
async def convert_cmd(ctx):
    # /convert 100 USD UZS
    parsed = CurrencyConverter.parse_convert_command(ctx.text)
    if not parsed:
        await ctx.reply("โŒ Foydalanish: /convert 100 USD UZS")
        return
    amount, from_c, to_c = parsed
    await ctx.typing()
    try:
        result = await currency.convert(amount, from_c, to_c)
        await ctx.reply(str(result))
    except Exception as e:
        await ctx.reply(f"โŒ {e}")

@bot.command("kurs")
async def rates_cmd(ctx):
    base = ctx.args[0].upper() if ctx.args else "USD"
    await ctx.typing()
    rates = await currency.get_popular_rates(base)
    await ctx.reply(currency.format_rates(rates, base))

# โ”€โ”€โ”€ Wikipedia โ†’ PDF โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
@bot.command("wiki")
async def wiki_cmd(ctx):
    if not ctx.args:
        await ctx.reply("๐Ÿ“– Foydalanish: /wiki Python\n(yoki /wiki Amir Temur)")
        return
    query = " ".join(ctx.args)
    await ctx.typing()
    result = await wiki.search(query)
    if not result:
        await ctx.reply(f"โŒ '{query}' bo'yicha hech narsa topilmadi.")
        return
    await ctx.reply(result.preview())
    await ctx.upload_document()
    pdf_path = await wiki.to_pdf(result)
    await ctx.send_document(pdf_path, caption=f"๐Ÿ“„ {result.title}")
    wiki.cleanup(pdf_path)

# โ”€โ”€โ”€ QR Kod โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
@bot.command("qr")
async def qr_cmd(ctx):
    if not ctx.args:
        await ctx.reply("๐Ÿ”ฒ Foydalanish: /qr https://google.com\nYoki: /qr Salom Dunyo!")
        return
    data = " ".join(ctx.args)
    await ctx.typing()
    path = await qr.generate(
        data,
        style="rounded",
        color="#1a237e",
        size=500,
    )
    await ctx.send_photo(path, caption=f"โœ… QR kod tayyor!\n\n<code>{data[:80]}</code>")
    qr.cleanup(path)

# โ”€โ”€โ”€ WiFi QR โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
@bot.command("wifi")
async def wifi_cmd(ctx):
    args = ctx.args
    if len(args) < 2:
        await ctx.reply("๐Ÿ“ถ Foydalanish: /wifi [SSID] [Parol] [WPA|WEP|nopass]")
        return
    ssid = args[0]
    password = args[1]
    security = args[2] if len(args) > 2 else "WPA"
    await ctx.typing()
    path = await qr.wifi(ssid=ssid, password=password, security=security)
    await ctx.send_photo(path, caption=f"๐Ÿ“ถ WiFi: <b>{ssid}</b>")
    qr.cleanup(path)

# โ”€โ”€โ”€ URL yuborilsa avtomatik video yukla โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
@bot.message(Filter.AND(Filter.is_url, Filter.NOT(Filter.text_startswith("/"))))
async def auto_video(ctx):
    url = ctx.text.strip()
    if VideoDownloader.is_supported(url):
        await ctx.reply(
            "๐Ÿ”— Link topildi! Yuklab beraymi?",
            keyboard=bot.inline_keyboard([
                [
                    {"text": "๐Ÿ“น Video (720p)", "callback_data": f"dl_video_720p:{url[:100]}"},
                    {"text": "๐ŸŽต MP3", "callback_data": f"dl_audio:{url[:100]}"},
                ]
            ])
        )

# โ”€โ”€โ”€ Callback handlers โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
@bot.on("callback_query")
async def handle_callbacks(ctx):
    await ctx.answer()
    if ctx.data.startswith("dl_video_"):
        await ctx.reply("โณ Video yuklanmoqda... iltimos kuting.")
    elif ctx.data.startswith("dl_audio:"):
        await ctx.reply("โณ Audio yuklanmoqda... iltimos kuting.")

# โ”€โ”€โ”€ Run โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
if __name__ == "__main__":
    bot.run()

๐Ÿ“ฆ O'rnatish

pip install zehnex-pro

Barcha imkoniyatlar bilan:

pip install zehnex-pro[all]

๐Ÿงฉ Modullar

Modul Tavsif
ZehnexBot Asosiy bot engine (async polling)
VideoDownloader YouTube, TikTok, Instagram, Twitter va 1000+ saytdan video
CurrencyConverter Real-vaqt valyuta kurslari
WikiToPDF Wikipedia qidiruv va PDF generator
QRGenerator Chiroyli QR kod generatori
Router Handler guruhlovchi
Filter Xabar filtrlari
Context Handler kontekst obyekti

โšก Nima uchun Zehnex Pro tez?

  • httpx async HTTP โ€” bir vaqtda yuzlab so'rov
  • asyncio.Semaphore โ€” parallel xabar ishlash
  • Keepalive connections โ€” TCP qayta ulanish xarajatisiz
  • Smart caching โ€” valyuta kurslari 5 daqiqa keshlanadi
  • Executor โ€” og'ir operatsiyalar thread poolda

๐Ÿ“‹ Talablar

  • Python 3.9+
  • httpx โ€” async HTTP
  • yt-dlp โ€” video yuklovchi
  • reportlab โ€” PDF generator
  • qrcode[pil] โ€” QR kod
  • Pillow โ€” rasm ishlash

๐Ÿ“„ Litsenziya

MIT License โ€” bepul foydalaning, o'zgartiring, tarqating!


Zehnex Pro 1.0.1 โ€” Made with โค๏ธ for Uzbek developers

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

zehnex_pro-1.0.1.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zehnex_pro-1.0.1-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

Details for the file zehnex_pro-1.0.1.tar.gz.

File metadata

  • Download URL: zehnex_pro-1.0.1.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for zehnex_pro-1.0.1.tar.gz
Algorithm Hash digest
SHA256 a07daf4feb414de771e0e9d1fe877a02c2535a69bb8a92c88a14ac952bac98a3
MD5 00fcbaf9ccae2b91d209886d6fadcccf
BLAKE2b-256 4eda07c8e342fac7ec45025e09c053d0f3ee45bd5540895174ddfc36b072baa6

See more details on using hashes here.

File details

Details for the file zehnex_pro-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: zehnex_pro-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 23.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for zehnex_pro-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9f27988f818d297e8b8ee3fdd8a9560415b06e76001938682c9b5e0def3d1482
MD5 63aae69f6c9432aa5a69e1af5e9a2445
BLAKE2b-256 d7e98fed13959a0f0585b22c65ebb1282fab75c3e23a638c36d0512ab5eb3b0e

See more details on using hashes here.

Supported by

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