disagreement/docs/task_loop.md
2025-06-09 22:25:14 -06:00

371 B

Task Loops

The tasks extension allows you to run functions periodically. Decorate an async function with @tasks.loop(seconds=...) and start it using .start().

from disagreement.ext import tasks

@tasks.loop(seconds=5.0)
async def announce():
    print("Hello from a loop")

announce.start()

Stop the loop with .stop() when you no longer need it.