N
N
NoDeJs2292020-05-19 17:51:59
In contact with
NoDeJs229, 2020-05-19 17:51:59

How to wait for a message from the user on Node.Js 12.16.3 for VK bot??

I am making a bot for VK. I am making a riddle game. And I need to make sure that if the player writes the wrong answer, the bot answered him incorrectly. But only when the player started playing. If possible. Please tell me

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2020-05-19
@loonny

Store in the database the user's ID and the number of the riddle that he is currently solving Let's
assume the following dialogue:
5ec8336dcb8a3290734064.jpeg
What do we see? The bot accepts 2 commands "start" and "more", both teams do the same thing - they send a riddle, so we will assume that this is the same command.
1) The user writes "start" or "more"
2) The bot sends a task and fixes the user ID and the number of the riddle that he guesses in the database.
3) The user guesses "15 Teletubbies"
4) The bot looks at the user ID that he wrote, looks in the database for the number of the riddle that he is now guessing. Then, in the Riddles Database, it searches for this riddle by number and compares the guess that the user gave and the correct answer.
5) The correct answer is "seven kids", and the user answered "15 Teletubbies" means not true, we answer the user "not true".
6) The user writes another guess "seven kids"
7) step 4 is repeated, the correct answer is "seven kids", and the user answered "seven kids" means true, we answer the user "correct" and delete information about him from the database.
And so in a circle. I hope I explained clearly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question