A trivia bot to get random quizzes in private chat or in groups with a ranking system.
Trivia Bot send quiz to chat (groups or personal chats) and if someone answers correctly, add a point. Also, can send a ranking with all members group with the points accumulated.
-
Download bot files from: https://github.com/Kekko01/Trivia-Bot-Telegram/archive/refs/heads/main.zip
-
Extract it and open folder
-
Create file named credentials.py with the DB credentials and Telegram Token:
telegram_token = "" # Telegram Bot Token db_host = "" # Database host name db_name = "" # Database database name db_user = "" # Database user name db_password = "" # Database user password
-
Create a MySQL DB o similar like MariaDB, and start this query in the database:
CREATE TABLE `ranking` ( `user_id` bigint NOT NULL, `chat_id` bigint NOT NULL, `username` varchar(50) NOT NULL, `date` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-
Install dependencies:
pip install -r requirements.txt
-
Start the bot:
python bot.py
Go here: https://www.python.org/downloads/ and install the verson for yout PC
You can install for example XAMPP
Telegram Official Guide: https://core.telegram.org/bots#3-how-do-i-create-a-bot
Yes, there are commands:
start - Start the bot
quiz - Send a quiz
help - Send help message
ranking - Send the ranking of the chat
points - Send the sum of your points
vote - Vote the bot in BotsArchive
code - Project's GitHub Page
Don't worry, please you can found or create a issue here: https://github.com/Kekko01/Trivia-Bot-Telegram/issues