Skip to main content

Client library for Delta Chat core JSON-RPC interface

Project description

Delta Chat client library for Python

Latest Release CI Code style: black

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deltachat2-0.9.0.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deltachat2-0.9.0-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file deltachat2-0.9.0.tar.gz.

File metadata

  • Download URL: deltachat2-0.9.0.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for deltachat2-0.9.0.tar.gz
Algorithm Hash digest
SHA256 9257a644360dc19b301bcb35924c25b47925a396f77afcf2d86d37ff8e816995
MD5 0f6e89373933e7d2359b34cddc963ce1
BLAKE2b-256 f123f435e18945dcd867c02ea4a43816c2f8cb0984b0ff333d826f77c1633d40

See more details on using hashes here.

File details

Details for the file deltachat2-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: deltachat2-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for deltachat2-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b0996c919adbf7a02f5d8ab0c7e2505549d2b426048b2d5b8ef3a7977c02210
MD5 0f0bf77ddae420d45e3adf803264e788
BLAKE2b-256 6c1a9eeff3cf4dba44d0eaee3d2775d1adfb3be8a27e9230b9d1d43cf331be15

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page