mirror of
https://github.com/chatmail/core.git
synced 2026-04-05 23:22:11 +03:00
To preview the docs, run:
```
scripts/build-python-docs.sh
firefox dist/html/index.html
```
I have removed the Makefile because modern Sphinx Makefile is just a
wrapper for `sphinx-build -M`:
3596590317/sphinx/templates/quickstart/Makefile.new_t
and sphinx-quickstart even has an option `--no-makefile`.
`make.bat` makes even less sense.
In `scripts/build-python-docs.sh` I use `sphinx-build` directly
without `make` wrapper.
60 lines
1.7 KiB
ReStructuredText
60 lines
1.7 KiB
ReStructuredText
Examples
|
|
========
|
|
|
|
Once you have :doc:`installed deltachat bindings <install>`
|
|
you need email/password credentials for an IMAP/SMTP account.
|
|
Delta Chat developers and the CI system use a special URL to create
|
|
temporary email accounts on `testrun.org <https://testrun.org/>`_ for testing.
|
|
|
|
Receiving a Chat message from the command line
|
|
----------------------------------------------
|
|
|
|
Here is a simple bot that:
|
|
|
|
- receives a message and sends back ("echoes") a message
|
|
|
|
- terminates the bot if the message `/quit` is sent
|
|
|
|
.. include:: ../../examples/echo_and_quit.py
|
|
:literal:
|
|
|
|
With this file in your working directory you can run the bot
|
|
by specifying a database path, an email address and password of
|
|
a SMTP-IMAP account::
|
|
|
|
$ cd examples
|
|
$ python echo_and_quit.py /tmp/db --email ADDRESS --password PASSWORD
|
|
|
|
While this process is running you can start sending chat messages
|
|
to `ADDRESS`.
|
|
|
|
Track member additions and removals in a group
|
|
----------------------------------------------
|
|
|
|
Here is a simple bot that:
|
|
|
|
- echoes messages sent to it
|
|
|
|
- tracks if configuration completed
|
|
|
|
- tracks member additions and removals for all chat groups
|
|
|
|
.. include:: ../../examples/group_tracking.py
|
|
:literal:
|
|
|
|
With this file in your working directory you can run the bot
|
|
by specifying a database path, an email address and password of
|
|
a SMTP-IMAP account::
|
|
|
|
python group_tracking.py --email ADDRESS --password PASSWORD /tmp/db
|
|
|
|
When this process is running you can start sending chat messages
|
|
to `ADDRESS`.
|
|
|
|
Writing bots for real
|
|
-------------------------
|
|
|
|
The `deltabot repository <https://github.com/deltachat/deltabot#deltachat-example-bot>`_
|
|
contains a little framework for writing deltachat bots in Python.
|
|
|