I am using Python with discord.py
. Documentation here
I\'ve got a bot that is running on a Discord server that links the server with a subr
The other answers here don't take into account discord.py's helpful tasks.loop
decorator.
To make an event occur every 5 seconds, you would use
from discord.ext import tasks, commands
class MyCog(commands.Cog):
def __init__(self):
self.foo.start()
def cog_unload(self):
self.printer.cancel()
@tasks.loop(seconds=5.0)
async def foo(self):
print('bar')
More can be found here: https://discordpy.readthedocs.io/en/latest/ext/tasks/