A Telegram bot to practice for the US citizenship civics quiz
.idea | ||
gradle/wrapper | ||
src | ||
.gitignore | ||
build.gradle.kts | ||
docker-compose.yml | ||
Dockerfile | ||
gradlew | ||
gradlew.bat | ||
LICENSE | ||
README.md | ||
settings.gradle.kts |
Civics Quiz Bot
This is a small project I put together to help my wife study for her US Civics Exam. It's essentially a flashcards app, with the following features:
- automatic question updates
- spaced repetition
- scheduled reminders
Usage
Prerequisites
- Telegram bot token
- JDK 17 or higher
- PostgreSQL 14
Building
Gradle
The project uses gradle. You can build a JAR file with the following command:
./gradlew shadowJar
You can then run it with the following command:
java -jar build/libs/civics-quiz-bot.jar
Docker
There is also a Dockerfile included. If you'd like to use that instead, you can run the following command:
docker build -t civics-quiz-bot .
You can then run it with the following command:
docker run civics-quiz-bot
Configuration
Regardless of how you build the JAR, there are a few configuration options that need to be set via environment variables.
Environment Variable | Default Value | Description |
---|---|---|
TELEGRAM_TOKEN |
Telegram bot token | |
CIVICS_DB_HOST |
localhost |
Hostname for PostgreSQL server |
CIVICS_DB_PORT |
5432 |
Port for PostgreSQL server |
CIVICS_DB_USER |
postgres |
Username for PostgreSQL server |
CIVICS_DB_PASSWORD |
postgres |
Password for PostgreSQL server |