Answer the question
In order to leave comments, you need to log in
How to make sure that the cycle does not affect what should not be affected?
Is there any way to make sure that the timeout element is not affected by the loop? The fact is that there is a continue in the code - if the condition is not true, then the bot waits for the button to be pressed again (code repetition), without this cycle, the bot will not wait for the button to be pressed again, but the time is recalculated with this cycle. (the time is needed to cancel the buttons and it is related to the balance, if the user forgets to click on them, he will return)
Code snippet:
while True:
response = await self.bot.wait_for('button_click', timeout=60) # Бот ждет нажатия кнопки в течение 60-ти секунд (discord.py)
Answer the question
In order to leave comments, you need to log in
in while true specify the necessary parameters, and there is such a cool thing elif, and there you already specify if 60 seconds have passed, then the cycle will start again
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question