Cant stop loop #6043
Unanswered
mrracoonman
asked this question in
Q&A
Cant stop loop
#6043
Replies: 1 comment 2 replies
-
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to create a loop to set an announcement every so often and not have to worry about sending it every 30 min or so. I managed to get my bot to loop it, but I can't stop the loop.
This is what I have to create the loop, but what would I use to stop it?
@bot.command()
async def loop(ctx, arg):
while True:
await ctx.send(f'{arg}')
await asyncio.sleep(1800)
@bot.command()
async def loopinfo(ctx, arg):
bot.loop.create_task(loop(ctx, arg))
Win 10, python 3.8.6
Beta Was this translation helpful? Give feedback.
All reactions