Replies: 2 comments
-
UpdateI've started work on a system to do it, you can see it on this branch and try it for yourself if you like |
Beta Was this translation helpful? Give feedback.
0 replies
-
Update 2Finalized the documentation today and added it with #8 today. Please make an issue report if you see any issues with events! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey Everyone!
I've been thinking recently of ways I could improve the modularity of the bot and I had the idea to add a system to subscribe to discord events. The events would likely cover most (if not all) of the events outlined in the API reference for discord.py. It would likely be similar to the commands registry, events could be loaded from a folder (
event_handlers
?events
?) where it registers itself and the event it wants to subscribe to.I might end up using a dynamic system where the event handler uses the event function name (
on_connect
,on_disconnect
, etc.) and it uses a "Monkey Patch" to dynamically add a client event handler for that event, but that raises the question: What if you want multiple handlers listening to the same event? This proves to be an interesting challenge and I'm not sure how viable it is to complete without significant effort on my part.Event registry example
An example for adding an event handler function dynamically would be the following
In conclusion
What do you think? Should I add a system like this where users can register custom event handlers? Does anyone have suggestions for code to implement something like this?
Beta Was this translation helpful? Give feedback.
All reactions