Open dekarrin opened 6 years ago
I believe this is how you would do a background task:
https://github.com/Rapptz/discord.py/blob/async/examples/background_task.py
I think you basically implement the method and then register it with the asyncio loop. But i am not exactly sure how this would fit into the modular pattern of the bot, that would take some more thinking than i am willing to do tonight. I will look this over again in the morning.
Looking for an event to fire on a time-basis for a handler, and give all handlers a chance to handle. Example: Every 1 minute (or some suitable granularity), fire the timed_action() event. Handler implementations could choose to actually perform an action based on some monotonic clock of their own (or pass a single monotonic "tick clock" to the methods).
This would allow, for example, a catfact to be displayed every 15-30 minutes (random interval).