I have a discord bot that controls some RGB lights. I want a pattern to repeat. However, I need the loop to break as soon as any new command is typed.
@client.command()
async def rainbow(ctx):
await ctx.send("It is rainbow")
while True:
rainbow_cycle(0.001)
I know while true loops can't be broken but I do not know another way to loop this function. If the full code is needed here is the Github link https://github.com/MichaelMediaGroup/Discord_controlled_lights/blob/main/discord/main.py
Thank you for the help