Python client for the Ashur bot API
Project description
AshurBot Python Client Library
A Python client for the Ashur bot API. This library allows you to interact with your Ashur bot using Python.
Installation
pip install ashur
Usage
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+
requestslibraryflasklibrary (for webhook server)
License
AGPL-3.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ashur-0.1.1.tar.gz
(15.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
ashur-0.1.1-py3-none-any.whl
(16.1 kB
view details)
File details
Details for the file ashur-0.1.1.tar.gz.
File metadata
- Download URL: ashur-0.1.1.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87762e93b0c9091638be134c0bf9b4a959cfd41235e0602dc64a99c4f27d1496
|
|
| MD5 |
662ca0afbd899a5b3a616f70e5e60267
|
|
| BLAKE2b-256 |
39b33ad0186c7b6d3700829fc21a21ad06bac98b77f98fceb2d828f9401dbff6
|
File details
Details for the file ashur-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ashur-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66bce089aebeed9246fbc66d9cad5a8475c7da3df446dd12421df3b718040374
|
|
| MD5 |
a743a4966d72d99ce1e94a106d873a09
|
|
| BLAKE2b-256 |
600a98822a289bda74279b487ec9de6ea41fc076fc2705432578e314896a6138
|