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

Uploaded Source

Built Distribution

deltachat2-0.1.1-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: deltachat2-0.1.1.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for deltachat2-0.1.1.tar.gz
Algorithm Hash digest
SHA256 31fdd70cd21a12610216ed66f552b7204eba4615c1bdc06bfc6c22c099baf094
MD5 7f819fd570827d58c9570a5bf6117111
BLAKE2b-256 d61624c5f8085515de533626389980f45aef41b5348e1a3183d761ef275fa210

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: deltachat2-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for deltachat2-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4253788bbf161bd3986e25bf83ce1426a3e6a056cd61475bfa94e126fd8af813
MD5 d2198b501eccd0def730c6f5a5c50302
BLAKE2b-256 969ae2cec274aac2f454fb676cf82effc86fc06441dbc24dbb3a017c20f23144

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