Skip to main content

TeleNet

TeleNet یک کتابخانه مدرن و قدرتمند Python برای ساخت ربات‌های تلگرام با asyncio است. با TeleNet می‌توانید ربات‌های پیچیده با پیام فارسی، دکمه‌های اینلاین، هندلینگ پیشرفته و مدیریت کامل کامندها بسازید.

🔹 ویژگی‌ها

  • طراحی مدرن و سبک با asyncio
  • پشتیبانی کامل از پیام‌های فارسی و Unicode
  • سیستم Router & Command برای مدیریت کامندها
  • پشتیبانی از Middleware
  • Long Polling و Webhook
  • Rate Limiting و Retry خودکار
  • پشتیبانی از دکمه‌های Inline و Reply Keyboard
  • کاملاً ماژولار و قابل گسترش

🔹 نصب

pip install telenet

نصب به صورت محلی (توسعه):

git clone https://github.com/yourusername/telenet.git
cd telenet
pip install -e .

🔹 شروع سریع

import asyncio
from telenet import TeleNetClient, Router, Command

TOKEN = "YOUR_BOT_TOKEN"
bot = TeleNetClient(TOKEN)
router = Router()

@router.on(Command("start"))
async def start(ctx):
    await bot.send_message(ctx.chat.id, "سلام! خوش اومدی 😎")

async def main():
    await bot.start()
    await bot.poll_updates(router=router)

if __name__ == "__main__":
    asyncio.run(main())

🔹 استفاده از دکمه‌های اینلاین

from telenet import TeleNetClient, Router, Command, InlineButton

@router.on(Command("start"))
async def start(ctx):
    await bot.send_message(
        ctx.chat.id,
        "یکی از گزینه‌ها را انتخاب کنید:",
        buttons=[
            [InlineButton("رفتن به گوگل", url="https://google.com")],
            [InlineButton("گزینه ۱", callback_data="opt1")]
        ]
    )

🔹 Middleware

from telenet.middleware import middleware

@middleware
async def logging_middleware(obj, next):
    print(f"📩 دریافت: {obj}")
    await next()
    print("✅ پردازش شد")

router.add_middleware(logging_middleware)

🔹 Webhook

from telenet.webhook import WebhookServer

async def main():
    await bot.start()
    server = WebhookServer(bot, router, path="/webhook", port=8443)
    await server.start()
    await asyncio.Event().wait()

🔹 نیازمندی‌ها

· Python 3.9+ · aiohttp>=3.9

🔹 لایسنس

MIT License


Designed by Ali-Jafari & GPT | With ❤

Metadata

Release files for telenet 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for telenet 3.0.0
File Size Uploaded
telenet-3.0.0.tar.gz 12.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for telenet 3.0.0
File Interpreter ABI Platform
telenet-3.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.5 kB

Release files / telenet-3.0.0.tar.gz

Download URL telenet-3.0.0.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a26efe7c39d62775af8889f9c7b3c3d0b5212784e7db665e12760679142868e8
BLAKE2b-256 checksum
How to use checksums
2a70a87b60cdadb412a47c4e7fe834670b4b364191f0ec478258b42c8797476f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Release files / telenet-3.0.0-py3-none-any.whl

Download URL telenet-3.0.0-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e1d79d2dca1c0e5737c6d348d3f525eb80723d4ac311bed6739abb1363ea99b
BLAKE2b-256 checksum
How to use checksums
0db05a194444f603cbb930a2d99acdd255987a46868b0559ea4a12a9c21b586b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

3.0.0 This release

2 release files

2.7.0

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page