How to create a Telegram bot quiz with one correct answer?

I’m working on a Telegram bot that needs to send quiz questions to users. Here’s my current implementation:

@bot.message_handler(commands=['quiz'])
def handle_quiz(message):
    if message.text == '/quiz':
        quiz_question = "What is the largest planet in our solar system?"
        answer_choices = ["Jupiter", "Saturn", "Earth", "Mars"]
        bot.send_poll(message.chat.id, quiz_question, answer_choices)

The problem I’m facing is that my bot accepts any option as correct. I want to set up a proper quiz where only one specific answer is marked as the right one. I need to use the native poll feature, not inline keyboard buttons. Can someone help me figure out how to specify which option should be the correct answer in a Telegram bot quiz?

You need the send_poll method with type='quiz' and correct_option_id. Here’s the modified code:

@bot.message_handler(commands=['quiz'])
def handle_quiz(message):
    if message.text == '/quiz':
        quiz_question = "What is the largest planet in our solar system?"
        answer_choices = ["Jupiter", "Saturn", "Earth", "Mars"]
        bot.send_poll(
            message.chat.id, 
            quiz_question, 
            answer_choices,
            type='quiz',
            correct_option_id=0  # Jupiter is at index 0
        )

correct_option_id uses the index of the right answer from your choices array (starts at 0). You can throw in an explanation parameter too if you want extra context when people see results. This makes a proper quiz poll where Telegram automatically shows right/wrong answers.

Had the same problem with my trivia bot last year. You’re missing the poll type and correct answer index in your code. Right now you’re creating a regular poll where all options are equal. Add type='quiz' and correct_option_id=0 to your send_poll call. Jupiter’s your first option, so it gets index 0. Without these, Telegram just makes a regular poll. Pro tip I learned the hard way - double-check that your correct_option_id actually matches where the right answer sits in your array. Screwed that up once and marked all the wrong answers as correct. You might also want to throw in an explanation parameter so users get some context with the results.

just add the quiz parameters to your existing code. change bot.send_poll(message.chat.id, quiz_question, answer_choices) to include type="quiz" and correct_option_id=0 since jupiter’s first in your array. that’s it - telegram handles everything else automatically.