Answer the question
In order to leave comments, you need to log in
How to make the bot wait for a response from the user?
I am writing a bot for VK in python and I don’t know how to make the bot wait for a response from the user
For example: The
bot writes: write a name, user: <name>, and the bot responds depending on the answer
I use the vk_api library
Answer the question
In order to leave comments, you need to log in
If you need to process a sequence of messages, describe a state machine.
Each state is a situation where the bot is waiting for a set of possible responses.
Each response is a transition from state to state.
When processing a message, you look at what transitions are in the current state, choose the most appropriate one and execute its logic.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question