2025-10-27 02:05:43 -05:00
|
|
|
import { EventEmitter } from 'node:events';
|
|
|
|
|
import type { Unicord } from '.';
|
|
|
|
|
import type { UnicordCommandContext } from './context';
|
2025-10-27 02:38:45 -05:00
|
|
|
import type { UnicordCommandOptions, UnicordEventContext, UnicordHandler } from './types/common';
|
2025-10-27 02:05:43 -05:00
|
|
|
|
|
|
|
|
export class UnicordEventProcessor extends EventEmitter {
|
|
|
|
|
constructor(private readonly self: Unicord) {
|
|
|
|
|
super();
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-27 02:38:45 -05:00
|
|
|
register<const Options extends UnicordCommandOptions>(event: string, handler: UnicordHandler<Options>) {
|
|
|
|
|
return super.on(event, handler);
|
2025-10-27 02:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
2025-11-02 01:03:30 -06:00
|
|
|
unregister<const Options extends UnicordCommandOptions>(event: string, handler: UnicordHandler<Options>) {
|
|
|
|
|
return super.off(event, handler);
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-27 02:05:43 -05:00
|
|
|
emit(event: string, context: UnicordCommandContext | UnicordEventContext, args: any[]): boolean {
|
|
|
|
|
return super.emit(event, context, args);
|
|
|
|
|
}
|
|
|
|
|
}
|