B
B
Bruceee2017-08-09 16:48:50
Bots
Bruceee, 2017-08-09 16:48:50

How to make a simple test (quiz) using a telegram bot?

Can you please tell me how to organize a sequence of questions from the bot to the user?

Interested in creating a bot that will ask questions and count the number of correct answers. There is a list of questions in a certain order that you need to ask the user. After each answer, the user should be asked the next question, after the last question, the user is shown the result - the sum of the points that he received as a result of passing the test.

Points that are not clear to me:

  1. How can I make the bot automatically ask the next question after the user answers? That is, it is not clear how to make an algorithm that would send the next question not with the help of an event handler, but in a loop until the questions run out, but at the same time so that it listens and remembers the user's answers between questions.
  2. How to store a session with a user? So that all answers of a particular user are saved while he passes the test. After passing, I plan to save the results in the database so that the next time the user can see the results of the last test.
  3. What to do in situations when the user started filling out the test, but did not finish?


To create a bot, I use the pyTelegramBotApi library.

I would be glad for any information on the topic!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question