Client library for Delta Chat core JSON-RPC interface
Project description
Delta Chat client library for Python
Client library for Delta Chat core JSON-RPC interface
Install
pip install deltachat2
To use this library, you need to have deltachat-rpc-server
program installed,
you can install it together with this library with:
pip install deltachat2[full]
Usage
Example echo-bot written with deltachat2:
from deltachat2 import events, run_bot_cli
hooks = events.HookCollection()
@hooks.on(events.RawEvent)
def log_event(bot, accid, event):
bot.logger.info(event)
@hooks.on(events.NewMessage)
def echo(bot, accid, event):
msg = event.msg
bot.rpc.misc_send_text_message(accid, msg.chat_id, msg.text)
if __name__ == "__main__":
run_bot_cli(hooks)
Save the above code in a echobot.py
file and run it with Python:
python echobot.py --email bot@example.com --password MyPassword
Then write to the bot address using your Delta Chat client to test it is working.
Developing bots faster ⚡
If what you want is to develop bots, you probably should use this library together with deltabot-cli-py, it takes away the repetitive process of creating the bot CLI and let you focus on writing your message processing logic.
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
Built Distribution
File details
Details for the file deltachat2-0.5.0.tar.gz
.
File metadata
- Download URL: deltachat2-0.5.0.tar.gz
- Upload date:
- Size: 19.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3ca8e962b90270fbeb88ac17b78d91bf1491c51d87b3a1ec5aea7f0cf3f5acb |
|
MD5 | a2a81bda9f7e55d35ac93f37eb374b62 |
|
BLAKE2b-256 | b15b5a82306176d8fa8c48018f0ba149c6b675a2b54851764ea4bfcb54d98764 |
Provenance
File details
Details for the file deltachat2-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: deltachat2-0.5.0-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c7fe5d6b674cc02e501387542ebc775d60c859165bcad6a98521d80ea2b202d |
|
MD5 | 532c1780f30365dd7525fde763a9b466 |
|
BLAKE2b-256 | 720a1d90addb1f3c72d37a5f72b48f155d452381bf7c00bfd25febe661cd6f90 |