Improve event handling
Closed this issue · 1 comments
s1kx commented
Since discordgo does not have a common interface amongst Events or a name/ID attached to them, it's only possible to handle events selectively with type switches or reflection.
Type switches get messy, and reflection is slow.
We should implement
-
EventType
- enum to denominate an Event, corresponding to each discordgo Event -
GetEventType()
- function to determine the type of a given event -
DiscordEvent
- wrapper class for discordgo Events, including fields such asEventType
and possibly introducing new ones such asEventGroup
,Tags
-
EventDispatcher
- handles dispatching events to hooks only when they are subscribed to them
s1kx commented
New event system is in place with events
subpackage handling event types, and the EventDispatcher
being responsible for sending events to the appropriate hooks.