Metadata-Version: 2.4
Name: ashur
Version: 0.1.1
Summary: Python client for the Ashur bot API
Author-email: NEOAPPS <asd22.info@gmail.com>
License-Expression: AGPL-3.0
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.20.0
Requires-Dist: flask>=2.0.0
Dynamic: license-file

# AshurBot Python Client Library

A Python client for the [Ashur bot API](https://github.com/Ashur-App/botapi). This library allows you to interact with your Ashur bot using Python.

## Installation

```
pip install ashur
```

## Usage

```python
from ashur.client import AshurBotClient

client = AshurBotClient(
    bot_token="YOUR_BOT_TOKEN",
    bot_secret="YOUR_BOT_SECRET"
    # api_base_url is optional and defaults to https://ashurbots.vercel.app
)

# Send a message
client.send_message(target="user_or_group_id", message="Hello!")

# Read messages
messages = client.read_messages(target="user_or_group_id")

# Webhook example
# You must set your bot's webhook URL to your server's public address + /webhook

def handle_event(event):
    print("Received webhook event:", event)
    # Do stuff with the event dict

client.on_webhook(handle_event)  # Starts a Flask server on http://0.0.0.0:8080/webhook
```

## Supported Methods
- `send_message(target, message)`
- `read_messages(target, limit=20)`
- `edit_message(target, message_id, new_text)`
- `delete_message(target, message_id)`
- `reply_to(target, message, reply_to_id)`
- `get_bot_info()`
- `update_bot_profile(name=None, pic=None, bio=None, webhook_url=None)`
- `list_chats()`
- `get_chat_info(chat_id, is_group=False)`
- `list_group_members(group_id)`
- `add_group_member(group_id, user_id)`
- `remove_group_member(group_id, user_id)`
- `pin_message(target, message_id, is_group=False)`
- `unpin_message(target, message_id, is_group=False)`
- `set_chat_title(group_id, name)`
- `set_group_photo(group_id, pic)`
- `leave_chat(target, is_group=False)`
- `get_message_by_id(target, message_id, is_group=False)`
- `forward_message(from_target, message_id, to_target, from_is_group=False, to_is_group=False)`
- `get_bot_stats()`
- `on_webhook(handler, host="0.0.0.0", port=8080, path="/webhook")` — Start a Flask server to receive webhook events

## Requirements
- Python 3.7+
- `requests` library
- `flask` library (for webhook server)

## License
AGPL-3.0
