How to create a Telegram quiz bot with scores and a leaderboard
By the Botable team
A Telegram quiz bot asks a question, offers answers as buttons, scores the reply, and keeps a running leaderboard. Describe your categories and scoring rules to Botable and it builds the question flow, the score table, and the leaderboard.
What is a quiz bot?
A Telegram quiz bot is a turn-taking game: it sends a question, waits for a tap on one of the answer buttons, tells the player whether they were right, and records the result. The interesting design decisions are all about state. A quiz needs to know which question each player is on, so two players in the same group do not overwrite each other's progress; it needs a score row per player; and it needs to decide what a session is — ten questions, one per day, or an endless streak. Leaderboards are cheap to add and are what makes a quiz bot spread inside a group, because a visible ranking gives people a reason to come back. On Botable the score and progress tables are created in the bot's own SQLite database as part of the build, so nothing has to be wired up by hand.
What commands does it have?
| Command | What it does |
|---|---|
/quiz | Starts a round and sends the first question |
/categories | Lists the question categories to choose from |
/score | Shows the player's score and streak |
/leaderboard | Top players in this chat or group |
/stop | Ends the round and saves the score |
What do you need before you start?
- A Telegram bot token from @BotFather
- Your questions, or a category list the bot can generate them for
- A decision on round length — fixed number of questions, or endless
How do you build it?
How should a quiz round be structured?
Pick a fixed length — ten questions is the common default — and say so when you describe the bot. A fixed round has a natural end, which is where you show the score and invite a rematch. An endless quiz never reaches that moment and loses people mid-stream.
How do answer buttons work?
Each option becomes an inline keyboard button, so a tap is one unambiguous answer and there is nothing to type or spell. Ask for the correct answer to be revealed after the tap; a quiz that stays silent about the right answer teaches nobody anything.
How do you keep scores per player in a group?
Scores are stored against the Telegram user ID, not the chat, so a player's total follows them and two people answering in the same group are tracked separately. Ask for the leaderboard to be scoped to the group if you want per-group competition.
Can questions be added later without rebuilding?
Yes. Questions live in the bot's database, so you can ask for a command that lets an admin add one from chat, or hand over a batch and have them loaded. Either way the running bot is edited in place.
A prompt you can use as-is
Paste this into Botable and adjust the details. It is specific on purpose — a vague description produces a vague bot.
Create a quiz bot. /categories lists Science, History, Geography and General knowledge. /quiz starts a 10-question round in the chosen category, one question at a time with four inline answer buttons, and reveals the correct answer after each tap. Track score and streak per Telegram user. /leaderboard shows the top 10 players in the current group. /score shows my own total.
Who is this bot for?
- Community managers who want a daily reason for members to open the chat
- Teachers and trainers running quick recall practice
- Anyone running a pub-quiz-style game across a group
What goes wrong with this kind of bot?
- Four answer buttons fit a phone screen; six wrap badly and get mis-tapped
- Decide whether a wrong answer ends the streak — players will notice either way
- Duplicate questions inside one round are the most common complaint; ask for them to be excluded
Questions about quiz bots
Can the bot generate its own questions?
Yes — describe the category and difficulty and questions can be generated rather than supplied. A fixed set is more predictable for exams or training; generated questions suit an endless casual quiz.
Does it work in channels as well as groups?
Quizzes need a reply, so they work in groups and private chats. A channel is broadcast-only; use a channel to announce the quiz and link into the group where it runs.