Answer the question
In order to leave comments, you need to log in
How to make a delay for a specific command?
Hello, there was a problem with the command delay. It would be desirable that not the entire script freezes in anticipation of the end of time, but a specific command. (So that other commands can be used). I used time.sleep() before, but its problem is that when the code "falls asleep" and the user continues to enter the same command even with a warning, the bot starts writing and writing non-stop after these commands. Is it possible to solve one of these problems and how?
Answer the question
In order to leave comments, you need to log in
Asyncio will help you with this https://docs.python.org/3/library/asyncio.html
Or threading https://docs.python.org/3/library/threading.html
Some libraries for working with Telegram have asynchronous methods . For example https://github.com/eternnoir/pyTelegramBotAPI#asyn...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question