Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time-based functionality #7

Open
dekarrin opened this issue Jan 24, 2018 · 1 comment
Open

Time-based functionality #7

dekarrin opened this issue Jan 24, 2018 · 1 comment
Labels
enhancement New feature or request

Comments

@dekarrin
Copy link
Member

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).

@dekarrin dekarrin added the enhancement New feature or request label Jan 24, 2018
@jghibiki
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants