B
B
BotTimofey2020-04-23 15:54:54
PHP
BotTimofey, 2020-04-23 15:54:54

How to wait for a message from the user in VK (bot in php)?

Hello, I am new to the development of bots for VK. I had a problem, after a certain message, the bot should expect a response from the user (in this case, this response should be written to a variable (but I can do this myself)). I read the documentation about the Long Poll Api, but still could not implement the task.
To make it clearer what I'm talking about, I'll give an example: let's say that we have some kind of roulette wheel. The bot writes: "Enter the bet." And after that, he must wait for the user's response, which will be the bet.
How to implement it? If it's not difficult, can you please provide an example code for this. Thank you in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iBird Rose, 2020-04-23
@BotTimofey

I have not worked with bots for a long time, but at one time the most optimal way was to present the work of the bot as a regular website.
conditionally in the table of users you create a column "location" and you make a start from it.
Tobish wrote a person for the first time - it means that in the location he is on the "main". Tobish you enter "/"
he enters your bets - you enter "/bet"
i.e. if a person is now on "/bet" and he wrote something, then he made a bet. that's how you process it.
I hope the logic is clear.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question