No description
  • Python 98.1%
  • Shell 1.9%
Find a file
2026-02-09 13:23:14 -05:00
config.json add shitcounter reset 2026-02-08 17:54:53 -05:00
matrix-bot.py add docs on verifying a session, youtube and wiki search 2026-02-09 13:23:14 -05:00
pantalaimon-wrapper.sh tweaked it a bit 2026-02-08 15:13:53 -05:00
pantalaimon.md tweaked it a bit 2026-02-08 15:13:53 -05:00
README.md add docs on verifying a session, youtube and wiki search 2026-02-09 13:23:14 -05:00
verify_device.py Cleaned up a bunch of functions, and started moving over bot commands from previous app 2026-02-07 14:45:13 -05:00

matrix-bot

Files

  • config.json stores variables used by the bot
  • matrix-bot.py the bot
  • verify_device.py used to verify the bot session (currently not working)

Setup

Prerequisites

For encryption to work with the matrix-nio[e2e] python package, you will need to install the libolm-dev package on the OS.

apt-get install libolm-dev

Copy the files

Edit config.json with your settings.

Create the Python virtual environment

python3 -m venv /matrix-bot/venv
source /matrix-bot/venv/bin/activate
pip install --no-cache-dir "matrix-nio[e2e] feedparser bs4 httpx wikipedia"

Create a systemd service

Create the service file at /etc/systemd/system/matrix-bot.service

[Unit]
Description=Matrix Bot
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/matrix-bot
ExecStart=/matrix-bot/venv/bin/python -u /matrix-bot/matrix-bot.py
Restart=always

[Install]
WantedBy=multi-user.target

Reload systemd and enable matrix-bot to start at boot.

sudo systemctl daemon-reload
sudo systemctl enable --now matrix-bot
sudo systemctl start matrix-bot

Confirming successful bot login

The bot logs all details to journalctl (if running as a service).

To check the service:

sudo systemctl status matrix-bot

To view a live log:

sudo journalctl -u matrix-bot -f

Verifying bot session

Curerntly, the ability to verify your bot session by emoji is broken. The best workaround I have found is to use an older Element client (example: Element Classic on iOS) that still supports the verify by text method.

  1. Login to the app with the bots account and verify this login with a recovery key.
  2. Go to the User Settings > Security.
  3. Select the bots unverified session from the My Sessions list.
  4. Select Not trusted.
  5. Select Manually Verify by Text.
  6. It will show the session key. Click the Verify button.

It will now show the session has been trusted by you. This process requires zero interaction with the running bot.