This example is about creating a plugin for deltabot, a pluggable deltachat bot.
There are 2 alternative options available:
- using simplebot (simplebot is a maintained fork of deltabot with many plugins availible)
- using python directly (more controll, but also more code to take care of)
You need python 3.7 for this to work. (Newer versions could work, but this example was tested to work with this version, feel free to upgrade the example and drop us a pull request)
# Optional create virtualenv
pip install virtualenv
virtualenv .venv
source .venv/bin/activate
pip3 install -U pip wheel
# install deltachat
pip3 install --pre -U -i https://m.devpi.net/dc/master deltachat # see https://github.com/deltachat/deltachat-core-rust/tree/master/python if it doesn't work for instructions on how to install it from source)
# Install deltabot
pip install git+https://github.com/deltachat-bot/deltabot.git@ae298b414d0ed6b5ffbfcca466375f60e3a5b4b9 attrs
# init the bot (either set the env vars or replace them with the email credentials the bot should use)
deltabot --basedir=.data init $ADDR "$PASSWORD"
In deltabot you install python modules like this:
deltabot --basedir=.data add-module ./path/to/module.py
This folder contains two examples:
echo.py
- The clasic echo all text messagesecho_command.py
- An/echo [text]
command
So the commands are the following:
deltabot --basedir=.data add-module echo.py
deltabot --basedir=.data add-module echo_command.py
To start type:
deltabot --basedir=.data serve