Skip to content
Snippets Groups Projects
user avatar
wupo authored
7fda4959
History

nbspplenumbot

This is a mail bot to send plenum invitation messages.

Structure

There are five relevant files in this repository making the bot run:

requirements.txt

Contains all the dependencies required to run the bot.py script.

bot.py

This file contains the core bot logic and some hardcoded values. If you want to use the bot in different setups, these values must be changed accordingly.

nbspplenumbot.sh

This file is only needed to set up the environment for the bot. The bot won't run (be comfy) without these environment parameters set. The MAIL_* environment variables must contain valid login data for the mail server.

nbspplenumbot.service / nbspplenumbot.timer

These files contain systemd unit configurations to make the bot run at discrete points in time.

Setup

  • Create a new directory on your machine e.g. mkdir /home/bots/scripts/nbspplenumbot

  • install python if not already installed, create and activate a new virtual environment

    sudo apt install python3.8-venv 
    python3 -m venv /home/bots/scripts/nbspplenumbot/venv
    . /home/bots/scripts/nbspplenumbot/venv/bin/activate
  • Copy all five project files to the created directory

  • Install requirements pip install -r requirements.txt

  • Move the systemd unit files to systemd

    sudo mv /home/bots/scripts/nbspplenumbot/nbspplenumbot.service /etc/systemd/system/
    sudo mv /home/bots/scripts/nbspplenumbot/nbspplenumbot.timer /etc/systemd/system/
  • Enable the systemd timer unit sudo systemctl enable nbspplenumbot.timer