Answer the question
In order to leave comments, you need to log in
How to make the bot remember which question gets answered and which question to ask next?
Initial data: there is a chatbot that asks questions on the logical tree, receives answers from the user, writes the answers to the database.
Question: what is the logic of the bot's work in this case?
My options:
1. After each user's response, the bot receives information (user id, chat id, id of the question to which the response was received, response content), writes the received data to the database. !Returns to the database, gets the list of answered questions, runs through the tree of questions in the script and asks the next one. So every time, as soon as the next response from the user arrives.
2. The script is launched and is constantly in a running state, waits for a response, receives an answer, writes it to the database, and knows the next question without unnecessary access to the database, without "running through" the script with the question tree again. Those. the script ends only when the questions in the script are finished.
How is it usually implemented? Is it really necessary to constantly go over the tree of questions with an appeal to the database for previous answers?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question