refactor: decouple system events from command dispatch and add explicit system event handlers and improve gateway handling

This commit is contained in:
2026-05-17 22:27:25 -05:00
parent 8b1eecd823
commit ce45eacb3b
11 changed files with 313 additions and 84 deletions
+2 -2
View File
@@ -16,8 +16,8 @@ export class UnicordObjectCache<Entity> {
this.cache = new LRUCache<string, Entity>(maxCapacity);
this.type = type;
for (const event of events) {
this.self.onEvent(event, async (_context, e) => {
this.cache.set(e.id, factory[Trait.fromDiscord](e));
this.self.onSystemEvent(event, async (payload) => {
this.cache.set(payload.id, factory[Trait.fromDiscord](payload));
});
}
}