D
D
danilpudovkin332020-10-27 03:34:59
In contact with
danilpudovkin33, 2020-10-27 03:34:59

The VK bot answers only one person if they write at the same time, what should I do?

I wrote a primitive bot in python and ran into the problem that the bot only answers one person if they write at the same time and this often happens. How can I implement all this so that the bot answers and does not let anyone through, because if they write to one at the same time, it will answer, and the other will not even read and answer until you write a message again.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Purgaev, 2020-10-30
@danilpudovkin33

Your algorithm is something like this:

Message received -> message processing [ Taking time... waiting for function to execute... ]
Another message has arrived - the bot is still busy processing the first one, so it won't even receive it.

Do this:
Message received -> start asynchronous message processing function [ Processing is not expected to complete, message update continues immediately ]

M
marshadow, 2020-10-27
@marshadow

We are psychics, we know your code ... But seriously, then throw off the code

E
Erik Mikoyan, 2020-10-27
@erik_mikoyan

Read about asynchrony

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question