Home>

There is a bot store with a sqlite3 db that is not multi-threaded (I don't know any other db). If the user spams the bot, then the bot crashes because of the db. How to make it so that there is a delay before the new use of the command?

I can't paste the code. He's too big.

In general, letting the user go directly to the main database is not very cool, check for spam.

artemgh2022-01-14 08:05:40

If the bot is one constantly running process, then directly in it make a dictionary with clients and reflect in it who wrote when the last time. Take action if the timeout has not yet expired and a new command has been received. If the process is not permanently in memory or there are several of them, then use external storage of the same list of who when handled the removal of those who had timeouts, for this it is convenient to use Redis

Mike2022-01-14 08:21:00