Skip to main content

Faster, lighter, and cleaner alternative to Pyrogram / Pyroitaly. Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots

Project description

PyroItaly

PyroItaly Logo

PyroItaly هي مكتبة واجهة برمجة تطبيقات MTProto لـ Telegram مكتوبة بلغة Python، وهي نسخة محسنة ومعاد تسميتها من pyrogram.

الميزات

  • أداء محسن: استخدام uvloop وorjson وتقنيات النسخ الصفري لتحسين الأداء
  • استقرار أفضل: معالجة أفضل للأخطاء وإعادة الاتصال التلقائي
  • تجربة مطور محسنة: توثيق شامل وتعليقات نمطية ونظام تسجيل متطور
  • نظام البرامج المساعدة: دعم للبرامج المساعدة مع hooks/events
  • أدوات إدارة الجلسات: تصدير واستيراد الجلسات بسهولة
  • أوامر مفيدة: أوامر مدمجة مثل /ping و/status و/debug

التثبيت

pip install pyroitaly

للحصول على أداء أفضل، قم بتثبيت الإضافات الاختيارية:

pip install "pyroitaly[speedup]"

مثال سريع

بوت تيليجرام

from pyroitaly import Client, filters

app = Client(
    "my_bot",
    api_id=12345,
    api_hash="0123456789abcdef0123456789abcdef",
    bot_token="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"
)

@app.on_message(filters.command("start"))
async def start_command(client, message):
    await message.reply_text(f"مرحباً {message.from_user.mention}!")

app.run()

مستخدم عادي (Userbot)

from pyroitaly import Client, filters

app = Client(
    "my_account",
    api_id=12345,
    api_hash="0123456789abcdef0123456789abcdef"
)

@app.on_message(filters.command("ping", prefixes=".") & filters.me)
async def ping_command(client, message):
    await message.edit_text("Pong!")

app.run()

استخدام نظام البرامج المساعدة

from pyroitaly import Client
from pyroitaly.plugins import PluginSystem

app = Client("my_bot")
plugin_system = PluginSystem(app)

# تسجيل برنامج مساعد
plugin = plugin_system.register_plugin(
    name="my_plugin",
    version="1.0.1",
    description="برنامج مساعد للتجربة",
    author="PyroItaly"
)

# تسجيل أمر
@plugin_system.register_command("my_plugin", "hello", description="يقول مرحباً")
async def hello_command(client, message):
    await message.reply_text("مرحباً بك!")

# تسجيل hook
@plugin_system.register_hook("bot_start")
async def on_bot_start():
    print("تم تشغيل البوت!")

app.run()

استخدام إعادة الاتصال التلقائي

from pyroitaly import Client
from pyroitaly.plugins import AutoReconnect

app = Client("my_bot")
auto_reconnect = AutoReconnect(app)

async def main():
    await app.start()
    await auto_reconnect.start()
    
    # البوت سيعيد الاتصال تلقائياً عند انقطاع الاتصال
    
    await app.idle()

app.run(main())

إدارة الجلسات

from pyroitaly import Client
from pyroitaly.plugins import SessionManager

async def export_session():
    app = Client("my_account")
    await app.start()
    
    # تصدير الجلسة
    session_str = await SessionManager.export_session(app)
    print(f"جلستك: {session_str}")
    
    # تصدير الجلسة مع كلمة مرور
    encrypted_session = await SessionManager.export_session(app, password="my_password")
    print(f"جلستك المشفرة: {encrypted_session}")
    
    await app.stop()

async def import_session(session_str):
    app = Client("imported_session")
    
    # استيراد الجلسة
    await SessionManager.import_session(app, session_str)
    
    await app.start()
    me = await app.get_me()
    print(f"تم تسجيل الدخول كـ {me.first_name}")
    await app.stop()

المساهمة

المساهمات مرحب بها! يرجى اتباع هذه الخطوات:

  1. قم بعمل fork للمستودع
  2. قم بإنشاء فرع للميزة الخاصة بك (git checkout -b feature/amazing-feature)
  3. قم بعمل commit للتغييرات (git commit -m 'إضافة ميزة رائعة')
  4. قم بدفع الفرع (git push origin feature/amazing-feature)
  5. قم بفتح طلب سحب

الترخيص

هذا المشروع مرخص بموجب ترخيص GNU Lesser General Public License v3.0 - انظر ملف LICENSE للحصول على التفاصيل.

شكر وتقدير

  • Dan - مؤلف Pyrogram الأصلي
  • ItalyMusic - مؤلف PyroItaly

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

pyroitaly-1.0.1.tar.gz (490.9 kB view details)

Uploaded Source

Built Distribution

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

pyroitaly-1.0.1-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyroitaly-1.0.1.tar.gz
  • Upload date:
  • Size: 490.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.5

File hashes

Hashes for pyroitaly-1.0.1.tar.gz
Algorithm Hash digest
SHA256 72da1735df3ef1f72220cdfc03056ced5a8cd39c1e507a1574ea6c3d8e5b4411
MD5 8cda84550e9774820d7380a44e60becc
BLAKE2b-256 e49f3fa432b9e18c326e95efb405f81cd72a53e5c1b22316c104a595633a32bb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyroitaly-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.5

File hashes

Hashes for pyroitaly-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 33054d33cf5336ea293942d95a91b6abf9402efd7b14bcd559335d3d65cf6ec9
MD5 4d58031c7dc2cbe877ed5b7c045a5398
BLAKE2b-256 b9fd09d2cd0a5a194d55a6374c20fb7943556e030ef4d775d63888ca3478b153

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