the response provided to your handler is something like:
{'update_id': 696992167,
'poll': {
'id': '5920521737891479577',
'question': 'What is the capital of Ukraine?',
'options': [
{'text': 'Rabat', 'voter_count': 0},
{'text': 'Kyiv', 'voter_count': 1},
{'text': 'Luxembourg', 'voter_count': 0}],
'total_voter_count': 1, 'is_closed': False, 'is_anonymous': True,
'type': 'quiz', 'allows_multiple_answers': False,
'correct_option_id': 1, 'explanation_entities': [], 'close_date': None}}
Notice the options are the answer you provided and voter_count=1
tells you the one picked by the user.
You can then process the request and use/save the value as you need
def get_answer(update):
answers = update.poll.options
ret = ""
for answer in answers:
if answer.voter_count == 1:
ret = answer.text
return ret
In order to implement the quiz you need to define how to send a question and how to process the answer:
# send question
context.bot.send_poll(chat_id=xxx, question='The question?',
options=[], type=Poll.QUIZ, correct_option_id=n, is_anonymous=True)
# define method 'main_handler' to process the answer
updater.dispatcher.add_handler(PollHandler(main_handler, pass_chat_data=True, pass_user_data=True))