L
L
Lukas Tumas2020-04-29 10:26:29
Python
Lukas Tumas, 2020-04-29 10:26:29

How to make a command on time?

Good afternoon, how can I make a command on time? That is, someone enters a command and the next time can be used only after 10 minutes.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dev12345, 2020-04-29
@Lubitelok

Create a sqlite database, for example, 2 columns, 1 column - user ID, 2 column - the time when the command was last used, when the user entered the command, compare whether 10 minutes have passed.

V
Vladimir Kuts, 2020-04-29
@fox_12

If the project uses caching, then put some label in the variable in the cache with a lifetime of 10 minutes.
If there is a label in the cache - failure. If there is no label, then we put the label in the cache for 10 minutes, and execute the command.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question