This bot summarizes the weekly news of the Guild of Physics by parsing the raw contents of current news and feeding them to designated telegram groups on a schedule. The bot also features the following commands:
- Viewing the weekly news at any time in either Finnish or English
- Creating the next week's news (for admins)
- Previewing the next week's news (only for admins)
You can run the bot by building a Python environment and running it there or by running the preconfigured docker-compose service. Common steps:
- Obtain a bot token from the Bot Father
- Running this bot requires python3 and virtualenv packages. You can install virtualenv with
or you can install it globally without --user flag.
python3 -m pip install --user virtualenv
- Create a virtual environment and prepare it by activating and installing dependencies with the following commands:
python3 -m venv env source env/bin/activate pip install -r requirements.txt
- Start the bot in the environment that was created by running
python3 bot.py
(pre) If you have created these configurations before and have made changes to the bot files, you should rebuild the image by running
docker compose -f docker-compose.yml build
-
Set the token and usernames of bot admins in a
bot.env
file in a subfolderfk-viikkotiedotebot/env
. Example contents of thebot.env
-file:TIEDOTE_BOT_TOKEN=gmU8lKWwuxIIKju TIEDOTE_BOT_ADMINS=username1,username2 COMMUNICATIONS_OFFICER=name
-
(optional) Set a symlink from wordpress viikkotiedote folder to mails in root. This way generated weekly news are directly added to Wordpress.
-
Start the bot by running
docker compose -f docker-compose.yml up -d
-
Stop the bot and clean the environment by running
docker compose -f docker-compose.yml down