diff --git a/src/handler/plugins/plugin.ts b/src/handler/plugins/plugin.ts index 65ae4da..805e53a 100644 --- a/src/handler/plugins/plugin.ts +++ b/src/handler/plugins/plugin.ts @@ -18,6 +18,8 @@ import { CommandType } from '../..'; import type { AutocompleteCommand, BaseModule, ModuleDefs } from '../structures/module'; import { PluginType } from '../structures/enums'; import type { EventEmitter } from 'events'; +import type { ExternalEventCommand, SernEventCommand } from '../structures/events'; +import type SernEmitter from '../sernEmitter'; export interface Controller { next: () => Ok; @@ -37,13 +39,38 @@ export type CommandPlugin = { { type: PluginType.Command; execute: ( - wrapper: K extends CommandType.External ? EventEmitter : Client, + wrapper: Client, module: DefinitelyDefined, controller: Controller, ) => Awaitable>; } >; }[T]; + +export type ExternalEmitterPlugin = Override< + BasePlugin, + { + type: PluginType.Command; + execute: ( + wrapper: T, + module: DefinitelyDefined, + controller: Controller, + ) => Awaitable>; + } +>; + +export type SernEmitterPlugin = Override< + BasePlugin, + { + type: PluginType.Command; + execute: ( + wrapper: SernEmitter, + module: DefinitelyDefined, + controller: Controller, + ) => Awaitable>; + } +>; + export type EventPlugin = { [K in T]: Override< BasePlugin, diff --git a/src/handler/structures/events.ts b/src/handler/structures/events.ts index f6e86af..f2e008e 100644 --- a/src/handler/structures/events.ts +++ b/src/handler/structures/events.ts @@ -1,6 +1,11 @@ import type { Override } from '../../types/handler'; import type { BaseModule } from './module'; -import type { CommandPlugin, EventPlugin } from '../plugins/plugin'; +import type { + CommandPlugin, + EventPlugin, + ExternalEmitterPlugin, + SernEmitterPlugin, +} from '../plugins/plugin'; import type { CommandType } from './enums'; import type { SernEventsMapping } from '../sernEmitter'; import type { Awaitable, ClientEvents } from 'discord.js'; @@ -13,7 +18,7 @@ export type SernEventCommand[]; - plugins: CommandPlugin[]; + plugins: SernEmitterPlugin[]; execute(...args: SernEventsMapping[T]): Awaitable; } >; @@ -31,10 +36,10 @@ export type DiscordEventCommand[]; - plugins: CommandPlugin[]; + plugins: ExternalEmitterPlugin[]; execute(...args: unknown[]): Awaitable; } >;