Telegram Newsletter Bot for WUEST in the making.
Installation on your local machine:
Note, that this was written in Python 3.7. If you are still on 2.7, upgrade!
git clone git@github.com:wuest-halle/wuestbot.git
cd wuestbot
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
First configure your environment:
cat > .env <<EOF
# The API token to authenticate against Telegram
API_TOKEN=abcd123
# The Telegam user / chat IDs that are allowed to push messages
# to all users in the database
ADMINS=1235123,67342347,89945234
EOF
Use start.sh
to setup the database and create a gunicorn
server in front
of the bot:
./start.sh
Alternatively you can set up the DB manually:
cd bot/app/database
./db_create.py
You can enter data by running app/database/db_update.py
:
# Needs to be run from the wuestbot/bot directory.
$ ./app/database/db_update.py
What should be entered in the DB?
E - Event
A - Artist
P - Artist-Event Relation
C - Cancel
The database schema can be recreated at any time via bot/app/database/db_create.py
.
Database population is twofold: users are automatically added via the \start
command upon first conversation initilization. Events, artists and their relations are added via db_update.py
also residing in the app/database
subdirectory. It provides a very small CLI to insert new data, using the classes provided in db_objects.py
. Manual inputs to the db have to look like this:
The EMR of the database is as follows: