Skip to content

Change chain pattern to event dispatcher pattern #3

@01Dri

Description

@01Dri

The current event handling is based on a Chain of Responsibility. While it works, it introduces unnecessary overhead when the number of handlers grows. Every event must pass through multiple handlers until it reaches the correct one, resulting in O(n) traversal per event.

Since Discord events are strongly typed and usually handled by specific handlers, an Event Dispatcher pattern would be more appropriate. By using a dictionary keyed by event type, we can perform O(1) lookups and directly execute the relevant handlers.

This refactor will improve performance, scalability, and maintainability of the event processing pipeline.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions