A Delta Chat bot for group chats, built with Go. Patrizio responds to messages based on configured keyword filters, inspired by Miss Rose on Telegram. Its main aim is to be used in friend groups or with people known. Differently from Miss Rose, it does not serve as a bot moderator, since Delta Chat groups have no admin/member structure.
While it is not properly the penguin in the image, it comes from a funny Internet meme which was trending some time ago. Since I am always out of ideas for good names, I thought it was a good pick. After all, who does not like penguins?
make buildConfigure the bot with a Delta Chat email account:
./patrizio init bot@example.com YOUR_PASSWORDShare this link so users can contact the bot:
./patrizio link./patrizio serveThe bot will connect to Delta Chat and start processing messages. Add it to a group to use keyword filters, or send it a direct message to get help text.
Configuration is done via environment variables prefixed with PATRIZIO_:
| Variable | Default | Description |
|---|---|---|
PATRIZIO_DB_PATH |
./patrizio.db |
Path to the SQLite database file |
PATRIZIO_MEDIA_PATH |
./media |
Directory where media files are stored |
PATRIZIO_LOG_LEVEL |
info |
Log level |
The bot's Delta Chat account data is stored in a platform-specific config directory (e.g. ~/.config/patrizio/ on
Linux), overridable with --folder:
./patrizio --folder /custom/path serve # --folder is optional, config will be saved in your user home otherwiseBuild and run with Docker (this assumes you've already initialized your bot instance):
make docker-build
docker run -v patrizio-data:/data patrizio -f /data serveIf you prefer an orchestrated solution, you can use the included Docker Compose, which will build the image from the
source and serve it as it is. This is particularly useful if you do not want to rely on the provided Docker images, or if
you want to apply local edits. Before proceeding folder, a ./data folder is mandatory in order for this setup to work
properly. It is also necessary to give the right permissions to the folder, so that the non-root user in the container
has access to it:
mkdir -p ./data/{media,db}
sudo chown -R 65532:65532 ./data # 65532 is the UID of the image.Once setup, you have to populate the folder properly, which you can do with:
make docker-build
docker run --rm -v ./data:/data patrizio -f /data init
docker run --rm -v ./data:/data patrizio -f /data linkThen you can run it with:
docker compose up --build -dNote
The included Docker Compose has a built-in log rotation (up to 10MB)
A Make directive is available for a quick project setup. Note that this will not install any dependencies, i.e. Golang, Golint-ci and Pre-commit.
make project-setup| Target | Description |
|---|---|
make project-setup |
Setup project related hooks (doesn't install new software) |
make build |
Compile the binary |
make run |
Run the bot in serve mode |
make test |
Run all tests |
make lint |
Run golangci-lint |
make docker-build |
Build the Docker image |
make migrate |
Run pending database migrations |
make migrate-create NAME=<name> |
Create a new migration file |
make sqlc |
Regenerate Go code from SQL query files |
make doc-setup |
Command to only setup documentation (included in project setup) |
make doc-build |
Builds the documentation and output in site directory |
make doc-local |
Serves the documentation locally, at localhost:8000 |
make clean |
Remove build artifacts |
Migrations can be created with:
make migrate-create NAME=add_filters_tableThis creates a new .sql file in migrations/. Edit it, then run:
make migrateMigrations are also run automatically on bot startup.
SQL queries live in queries/ as .sql files. After editing, regenerate the Go code:
make sqlcGenerated code is written to internal/database/queries/.
As can be see by the openspec folder, the heavy lifting of this project has been done by using AI (Claude CLI, in
particular since I try to stick to local models hosted via Ollama as much as possible). This means, bootstrapping the
project and adding the very first feature. I would never had enough time to learn all the Delta Chat RPC basics and to
start the project. I understand someone might not be OK with it, but by using it and contributing, you accept this fact.
Other AI assistance tools will be used during the development, in particular with the aim to explore and learn Delta
Chat RPC and AI tools.
You've made 'till here and want to read more? Head over the project webiste for more!
AGPL-3.0-or-later. See LICENSE for the full text.
