Skip to content

[WIP] Asynchronous library to speedup Delta Chat bot development

License

Notifications You must be signed in to change notification settings

nelson9608/deltabot-cli-py

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deltabot-cli for Python

Code style: black

Asynchronous library to speedup Delta Chat bot development.

With this library you can focus on writing your event/message processing logic and let us handle the repetitive process of creating the bot CLI.

Install

pip install git+https://github.com/deltachat-bot/deltabot-cli-py.git

Installing deltachat-rpc-server

This package depends on a standalone Delta Chat RPC server deltachat-rpc-server program that must be available in your PATH. To install it check: https://github.com/deltachat/deltachat-core-rust/tree/master/deltachat-rpc-server

Usage

Example echo-bot written with deltabot-cli:

import asyncio
import logging
from deltabot_cli import BotCli, events

cli = BotCli("echobot")


@cli.on(events.RawEvent)
async def log_event(event):
    logging.info(event)


@cli.on(events.NewMessage)
async def echo(event):
    await event.chat.send_text(event.text)


if __name__ == "__main__":
    asyncio.run(cli.start())

If you run the above script you will have a bot CLI, that allows to configure and run a bot. A progress bar is displayed while the bot is configuring, and logs are pretty-printed.

For more examples check the examples folder.

Note: deltabot-cli uses deltachat-rpc-client library, check its documentation and examples to better understand how to use deltabot-cli.

About

[WIP] Asynchronous library to speedup Delta Chat bot development

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%