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.6.0.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

deltachat2-0.6.0-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: deltachat2-0.6.0.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for deltachat2-0.6.0.tar.gz
Algorithm Hash digest
SHA256 b1905723396de6e4095fdf56c153351b90a4e80268d087c3b60c3a7c223d19d2
MD5 758b8bcda629941f8715818b64fa9e61
BLAKE2b-256 02c580d1be51f752513910b8379cec71a22bf06d1bab79f75f8164ece3e720c6

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: deltachat2-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 19.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for deltachat2-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3da2632c2157b0ba4d97a0bba99e8a987d1816f11cd385e7cde7c22d0eb033ba
MD5 258864d4296311e553eef55203e795d5
BLAKE2b-256 7c152dcb48c08cc0421f1466b1f8e5130a0e394dbdf134958287d1526fc579b0

See more details on using hashes here.

Provenance

Supported by

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