Answer the question
In order to leave comments, you need to log in
How to create a timeout for the user?
Good afternoon. I was interested in the question of how to stop responding to a VK user? I have a bot on the vk-io library, I want it to stop responding to all messages and user actions within a certain time. setTimeout() only sets the timeout for the execution of the function, and after all, with each message, the function is restarted and the timeout is also reset. I don’t want to make records in the database and search among them as a consequence, how to make it easier?
Answer the question
In order to leave comments, you need to log in
Make a Set in which you will add the id of users who do not need to respond.
When such a user appears, then add him to the Set and set setTimeout () to remove the key (the user from the Set).
PS well, make a check for the presence of a key in the Set, so as not to respond to the users found.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question