Metadata-Version: 2.1
Name: eitaayarbot
Version: 1.0.0
Summary: Python SDK for Eitaa Bot API (sync & async)
Home-page: https://github.com/amirhossinpython/eitaaapi
Author: Amirhossein Khazaei
Author-email: amirhossin.khazaei@gmail.com
License: MIT
Keywords: Eitaa Bot,Python,SDK,Async,Sync,Messenger
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: httpx

# Eitaa Bot SDK

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

[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![GitHub](https://img.shields.io/github/stars/amirhossinpython/eitaabot.svg?style=flat-square)](https://github.com/amirhossinpython/eitaaapi)

## توضیحات (Description)

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

## نصب (Installation)



2.  نصب بسته با استفاده از pip:

```bash
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:

```python
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()


```
```python
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())

```
