PyroItaly
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()
المساهمة
المساهمات مرحب بها! يرجى اتباع هذه الخطوات:
- قم بعمل fork للمستودع
- قم بإنشاء فرع للميزة الخاصة بك (
git checkout -b feature/amazing-feature) - قم بعمل commit للتغييرات (
git commit -m 'إضافة ميزة رائعة') - قم بدفع الفرع (
git push origin feature/amazing-feature) - قم بفتح طلب سحب
الترخيص
هذا المشروع مرخص بموجب ترخيص GNU Lesser General Public License v3.0 - انظر ملف LICENSE للحصول على التفاصيل.
شكر وتقدير
- Dan - مؤلف Pyrogram الأصلي
- ItalyMusic - مؤلف PyroItaly
Metadata
Release files for pyroitaly 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyroitaly-1.0.1.tar.gz | 490.9 kB | Without provenance | Details for pyroitaly-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyroitaly-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for pyroitaly-1.0.1-py3-none-any.whl |
Total release size: 1.6 MB
Release files / pyroitaly-1.0.1.tar.gz
| Download URL | pyroitaly-1.0.1.tar.gz |
|---|---|
| Size | 490.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72da1735df3ef1f72220cdfc03056ced5a8cd39c1e507a1574ea6c3d8e5b4411
|
|
BLAKE2b-256 checksum How to use checksums |
e49f3fa432b9e18c326e95efb405f81cd72a53e5c1b22316c104a595633a32bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.5
|
Release files / pyroitaly-1.0.1-py3-none-any.whl
| Download URL | pyroitaly-1.0.1-py3-none-any.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
33054d33cf5336ea293942d95a91b6abf9402efd7b14bcd559335d3d65cf6ec9
|
|
BLAKE2b-256 checksum How to use checksums |
b9fd09d2cd0a5a194d55a6374c20fb7943556e030ef4d775d63888ca3478b153
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.5
|
Security for pyroitaly 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.