DiscQuiz is a Telegram bot that sends periodic quiz questions based on the WFDF Advanced Accreditation Quiz.
DiscQuiz has been developed using Docker Compose, hence it is recommended that you use Docker Compose to run the bot.
-
Install Docker Desktop (or Docker Engine if you are using a Linux machine).
-
Copy
docker-compose.ymlinto your local machine. -
In your
docker-compose.yml, update theDAILY_LEADERBOARD_TIME,LIST_OF_ADMINS,LOCAL_TIMEZONE, andTELEGRAM_BOT_API_TOKENenvironment variables with the appropriate values.- Obtain your Telegram user ID using this guide.
- Find your local timezone from this list.
- Create a new Telegram Bot and obtain your bot token using this guide.
Your
docker-compose.ymlshould look similar to this:services: server: image: discquiz-server container_name: discquiz-server volumes: - discquiz-db:/etc/discquiz environment: DATABASE_PATH: /etc/discquiz/discquiz.db telegram-bot: image: discquiz-telegram-bot container_name: discquiz-telegram-bot environment: DAILY_LEADERBOARD_TIME: 12:00 FLASK_API_URL: http://discquiz-server:5000 LIST_OF_ADMINS: "[123456789]" LOCAL_TIMEZONE: Asia/Singapore RULES_PAGE_URL: https://zackjh.github.io/discquiz/ TELEGRAM_BOT_API_TOKEN: 4839574812:AAFD39kkdpWt3ywyRZergyOLMaJhac60qc volumes: discquiz-db:
-
Start the application using:
$ docker compose up
The database does not have any quiz questions when the application is first initialised. Follow these steps to add quiz questions to the database:
-
Take the WFDF Advanced Accreditation Quiz.
-
Save the result page as a HTML file using this guide.
-
Copy the HTML file from your local machine into the
discquiz-servercontainer using:$ docker cp <local path to HTML file> discquiz-server:/app -
Run
config.pyin thediscquiz-servercontainer using:$ docker exec -it discquiz-server python config.py -
Follow the instructions in the CLI to add quiz questions to the database.
When prompted for the file path of the HTML file, enter the name of your HTML file (e.g. my_webpage.html).
-
Optionally, once you have added the quiz questions to the database, remove the HTML file from the
discquiz-servercontainer using:$ docker exec discquiz-server rm <name of HTML file>
| Command | Arguments | Functionality | Usage Example |
|---|---|---|---|
/start |
None | Checks if the bot is running properly. | /start |
/new <time> |
Time in HH:MM format | Sets up a quiz to be sent at the specified {time} daily. | /new 10:35 |
/remove <time> |
Time in HH:MM format | Removes the daily quiz scheduled for the specified {time}. | /remove 10:35 |
/schedule |
None | Displays all currently scheduled daily quizzes. | /schedule |
- Add the ability to schedule a daily leaderboard message
- Improve design of rules webpage