This bot summarizes the weekly news of the Guild of Physics by parsing the raw contents of current news. You can also view the newsletter later by sending the bot a command.
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 environment variables in a
bot.env. Example contents of thebot.env-file:commandline BOT_TOKEN=gmU8lKWwuxIIKju NEWSLETTER_BASE_URL=https://fyysikkokilta.fi/api/newsletter/telegram - (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