P
P
pivazik2020-06-06 22:36:53
Python
pivazik, 2020-06-06 22:36:53

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

1 answer(s)
S
ScriptKiddo, 2020-06-06
@pivazik

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 question

Ask a Question

731 491 924 answers to any question