Sending a discord message to break out of a loop

Ok so, in this specific code I made it so using the discord command “.start” a while loop would start to complete an action. How it worked is “.start” would turn the “b” variable into 20. And the while variable would work whenever the “b” variable was over 15. I made it so “.stop” would redefine the “b” variable into 5 however the loop still doesn’t break. What’s the reason for this?

it may be that each time that the on_message function is called it is a separated function call and can’t be influenced by others. So you made an infinite loop.
It may work if instead you have a database value that is changed.
But I would not made an infinite loop, it can crash or time out and do not work as intended

1 Like

Sorry for the late response but yeah, having a database value that changes does indeed work. Thanks for the help!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.