notflixbot
A general purpose matrix bot for matrix.sudo.is
,
trying to be extensible.
Features
- Matrix bot based on matrix-nio
- Unfurls YouTube titles and links to Invidous
- Add a movie to Radarr from IMDB link with
!add
- Webhooks listener. Handles Radarr, Sonarr, Grafana, Jellyfin, Slack and custom webhooks
- Uses a ZeroMQ
PAIR
socket overinproc://
transport between webhooks and Matrix client
Usage
The bot answers to the following commands by default:
!add ${IMDB_URL}
: Add a movie to Radarr!ruok
: Check if the bot is OK!whoami
: Show youruser_id
.!key_sync
: Force a key sync (experimental)!help
: Show help
Configuration
Please see config-sample.json
.
To configure where the webhook server listens:
"webhook": {
"host": "0.0.0.0",
"port": 3005
}
By default the webhook server listens on localhost:3000
.
Running the bot
usage: notflixbot [-h] [-d] [-c CONFIG] subcmd ...
positional arguments:
subcmd
start Start Matrix bot and webhook HTTP server
restore_login Start a new Matrix session
webhook Start webhook HTTP server
Healthcheck Run healthcheck for webhook HTTP server
nio Low-level stuff, helpful for dev
optional arguments:
-h, --help show this help message and exit
-d, --debug Enable debug output and logging (default: False)
-c CONFIG, --config CONFIG
Path to config file (default: /etc/notflixbot.json)
Start the bot
The simplest way to start the bot, will use the default configfile /etc/notflixbot.json
:
$ apt-get install libolm-dev
$ notflixbot start
notflixbot 0.3.0
Matrix bot user_id: @notflixbot:example.com
Matrix client syncing forever
Polling ZMQ socket for webhook messages
Webhook server listening on: http://127.0.0.1:3033
You can use the -c
flag to specify a path to a different config file:
$ notflixbot -c /path/to/a/different/config.json
Docker
You can also use docker (build from Dockerfile
or use pre-built image):
$ mkdir ${PWD}/data
$ docker run --name notflixbot --rm -v ${PWD}/data:/data -v ${PWD}/config.json:/etc/config.json benediktkr/notflixbot:latest
Make sure to configure credentials_path
and storage_path
to be
somewhere persisent, for example in /data
in this example.
Logging in
Your config has to set credentials_path
to a path to a file that the
bot can read and write, that will store the credentials (access token,
device id and user id) for the bot.
Log in and create the file with:
$ notflixbot restore_login -c config.json
Password:
You can also create the file if you have an access token and device_id handy:
{
"user_id": "@notflixbot:exmaple.com",
"device_id": "ABCDEF1234",
"acces_token": "abc123
}