Skip to main content

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+
  • requests library
  • flask library (for webhook server)

License

AGPL-3.0

Metadata

Release files for ashur 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ashur 0.1.2
File Size Uploaded Provenance
ashur-0.1.2.tar.gz 16.1 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 32.8 kB

Release files / ashur-0.1.2.tar.gz

Download URL ashur-0.1.2.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b57637b6bf2d8b86702d3cc41fe02b3ab0829deae0a1d9e9deedc3af5146b3e5
BLAKE2b-256 checksum
How to use checksums
e4fe557666b31493658920adedae71da6367002476d7dd4c9c53c6590f183178
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / ashur-0.1.2-py3-none-any.whl

Download URL ashur-0.1.2-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b6dc49634d4b0b48b882f75796d5b3f37871e19c235053eaca841a8bac4c35f
BLAKE2b-256 checksum
How to use checksums
a3ea8fbbae3619c8592a3cd09e354bd6fec68386f121dd31231ae87e8208ef56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Security for ashur 0.1.2

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.

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