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
Hashes for deltachat2-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 752522f03bc968efac3bc458e142ef229d6143444942092a4e1c43c8ef1e6e68 |
|
MD5 | 9ccd8aa7e6d9d78d90d661c52e89c63c |
|
BLAKE2b-256 | 49b984a4a7fab0106c955fcc279efdc958988e99e40ca71c7f02eeda41ae1ee7 |