Python. How do I make a delay without freezing the program?

When using time. sleep(x), the entire program stops. I also make a bot in which you need to wait after each action. You can't work all day without stopping, can you? No, you can't. After each work, you will need to rest for 1 real hour. But time. sleep (x) stops the ENTIRE program, and after each operation, no one can use the bot. How do I make a delay without freezing the program?

Author: TheNick - Ник, 2020-09-23

1 answers

I think you should use asyncio. sleep (3600) in your bot. Then your task will be asynchronous and the rest of the commands will work.

 0
Author: Roman Konnov, 2020-09-23 14:21:13