Telegram adventure
Attempt to make a choose-your-own-adventure game as a Telegram bot.
Requirements
| Name | Version |
|---|---|
| Python | 3.11.0 |
| sqlite3 | 3.41.2 |
| python-telegram-bot | 20.2 |
Quickstart
Install dependencies
pip install -r requirements.txt
Export environment variables (see below)
TELEGRAM_BOT_ACCESS_TOKEN=...
Run
py .src/bot.py
Development
Test with pytest
ptw
Story database
Create
sqlite3 adventure.db < sql/schema.sql
Load data
py ./sql/load_data.py
Dump data
sqlite3 adventure.db < sql/print_nodes.sql
sqlite3 adventure.db < sql/print_edges.sql
Show as a graph
Note: display layout is randomised, so the graph may look different each time.
py ./sql/display_graph.py
Telegram Access token
To obtain an access token for telegram, see help page, but in essence, talk to the BotFather.
The access token is used via an environment variable, or a .env file, which is not tracked by git.
touch .env
TELEGRAM_BOT_ACCESS_TOKEN=...
