Skip to main content

Eitaa Bot SDK

یک کتابخانه پایتون ساده و قدرتمند برای تعامل با API ربات‌های پیام‌رسان Eitaa.

License GitHub

توضیحات (Description)

این SDK راهی آسان برای ساخت و تعامل با ربات‌های Eitaa با استفاده از پایتون فراهم می‌کند. از عملیات همزمان (synchronous) و ناهمزمان (asynchronous) پشتیبانی می‌کند.

نصب (Installation)

  1. نصب بسته با استفاده از pip:
pip install eitaayarbot

🔹 کلاس‌ها و متدها

1. _BaseEitaaBot

کلاس پایه برای هر دو حالت سینک و آسنکرون، شامل توابع کمکی.

متد توضیح
_build_url(method) ساخت URL کامل برای یک متد API
_filter_none(data) حذف مقادیر None از دیکشنری

2. EitaaBot (سینک / Sync)

متد پارامترها توضیح
__init__(token, timeout=20) token, timeout مقداردهی اولیه ربات
_request(method, http_method="POST", data=None, files=None) method, http_method, data, files ارسال درخواست به API
get_info() – دریافت اطلاعات ربات
send_message(chat_id, text, title=None, notification_disable=None, reply_to_message_id=None, date=None, pin=None, viewCountForDelete=None) پارامترهای اختیاری ارسال پیام متنی با گزینه‌های پیشرفته
send_file(chat_id, file_path, caption=None, title=None, date=None) پارامترهای اختیاری ارسال فایل با کپشن
send_document(chat_id, document_path, caption=None, date=None) پارامترهای اختیاری ارسال سند
close() – بستن اتصال

3. AsyncEitaaBot (آسنکرون / Async)

متد پارامترها توضیح
__init__(token, timeout=20) token, timeout مقداردهی اولیه ربات
_request(method, http_method="POST", data=None, files=None) method, http_method, data, files ارسال درخواست به API
get_info() – دریافت اطلاعات ربات
send_message(chat_id, text, title=None, notification_disable=None, reply_to_message_id=None, date=None, pin=None, viewCountForDelete=None) پارامترهای اختیاری ارسال پیام متنی
send_file(chat_id, file_path, caption=None, title=None, date=None) پارامترهای اختیاری ارسال فایل با کپشن
send_document(chat_id, document_path, caption=None, date=None) پارامترهای اختیاری ارسال سند
close() – بستن اتصال

توجه: تمام متدهای Async باید با await فراخوانی شوند.


نحوه استفاده (Usage)

نمونه‌ای ساده از نحوه استفاده از SDK:

from eitaayarbot import EitaaBot

# جایگزین کردن "YOUR_BOT_TOKEN" با توکن ربات Eitaa خودتان

BOT_TOKEN = "YOUR_BOT_TOKEN"

# ایجاد یک نمونه از EitaaBot
bot = EitaaBot(token=BOT_TOKEN)

try:
    # دریافت اطلاعات ربات (Get bot info)
    info = bot.get_info()
    print(info) # Bot: {info['username']}

    # ارسال یک پیام (Send a message)
    chat_id = "YOUR_CHAT_ID"  # جایگزین کردن با شناسه چت مورد نظر (Replace with your desired chat ID)
    text = "سلام دنیا! این یه پیام از ربات Eitaa من هست." # Hello world! This is a message from my Eitaa bot.
    bot.send_message(chat_id=chat_id, text=text)
    print("پیام با موفقیت ارسال شد.") # Message sent successfully.

    # ارسال یک فایل (Send a file)
    file_path = "example.txt"  # جایگزین کردن با مسیر فایل مورد نظر (Replace with your desired file path)
    with open(file_path, "w") as f:
        f.write("این یه فایل نمونه است.") # This is a sample file.
    bot.send_file(chat_id=chat_id, file_path=file_path, caption="فایل نمونه") # Sample file
    print("فایل با موفقیت ارسال شد.") # File sent successfully.

except RuntimeError as e:
    print(f"خطا: {e}") # Error: {e}

finally:
    # بستن اتصال (Close the connection)
    bot.close()
import asyncio
from eitaayarbot import AsyncEitaaBot

async def main():
    token = "توکن-ربات-تو"
    bot = AsyncEitaaBot(token)

    info = await bot.get_info()
    print(info)

    await bot.send_message(chat_id=12345, text="سلام دنیا Async!")

    await bot.send_document(chat_id=12345, document_path="path/to/file.pdf", caption="یک سند")

    await bot.close()

asyncio.run(main())

Metadata

Release files for eitaayarbot 1.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 eitaayarbot 1.0.0
File Size Uploaded Provenance Actions
eitaayarbot-1.0.0.tar.gz 4.5 kB Without provenance Details for eitaayarbot-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 9.2 kB

Release files / eitaayarbot-1.0.0.tar.gz

Download URL eitaayarbot-1.0.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1690470cd20721cf726b6f0555645c7e6fa7004dcdb95e88de7db4bda9600d89
BLAKE2b-256 checksum
How to use checksums
ce658e65a8076662e656818d5ef726bded94d8087e3abbf15b9f027d01440765
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / eitaayarbot-1.0.0-py3-none-any.whl

Download URL eitaayarbot-1.0.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c918bbbc8a87567c733ab2fcc70bebbfe4d52cb4cca77f33f9ba8689b128ae95
BLAKE2b-256 checksum
How to use checksums
cbeb464900cf5b55dae2c502c81f2cb10c7276494311b01a87350befd4c0c77e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Security for eitaayarbot 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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