Moving to an event bus strategy for commands

This commit is contained in:
2025-02-05 20:43:43 -06:00
parent 8333ab2d44
commit d8b85e60ec
2 changed files with 13 additions and 11 deletions
+8 -8
View File
@@ -205,15 +205,15 @@ export class Gateway {
// Generate context
const context = new Context(this.client, this.api, { message });
// Dispatch event for the command
// this.bus.emit(`${HandlerType.ChatCommands}:${command}`, context, args);
this.bus.emit(`${HandlerType.ChatCommands}:${command}`, context, args);
// // Check if command exists
if (this.processor[HandlerType.ChatCommands].has(command)) {
// Execute the handler
this.processor[HandlerType.ChatCommands].execute(command, context, args);
} else {
// TODO: Custom unknown command handler
// context.reply(`Unknown command: ${command}`);
}
// if (this.processor[HandlerType.ChatCommands].has(command)) {
// // Execute the handler
// this.processor[HandlerType.ChatCommands].execute(command, context, args);
// } else {
// // TODO: Custom unknown command handler
// // context.reply(`Unknown command: ${command}`);
// }
}
};