diff --git a/src/handler/events/interactionCreate.ts b/src/handler/events/interactionCreate.ts index ac1fda4..a1d53b0 100644 --- a/src/handler/events/interactionCreate.ts +++ b/src/handler/events/interactionCreate.ts @@ -154,7 +154,7 @@ function autoCmpHandler(mod: Module | undefined, interaction: AutocompleteIntera const selectedOption = mod.options?.find(o => o.autocomplete && o.name === choice.name); if (selectedOption !== undefined && selectedOption.autocomplete) { return of( - selectedOption.command.onEvent.map(e => e.execute([interaction], controller)), + selectedOption.command.onEvent.map(e => e.execute(interaction, controller)), ).pipe( map(res => ({ mod, diff --git a/src/handler/structures/events.ts b/src/handler/structures/events.ts index 6fc1ad5..590d958 100644 --- a/src/handler/structures/events.ts +++ b/src/handler/structures/events.ts @@ -1,21 +1,22 @@ import type { Override, SernEventsMapping } from '../../types/handler'; -import type { BaseModule } from './module'; +import type { BaseModule, EventModuleDefs } from './module'; import type { - CommandPlugin, - EventPlugin, + DiscordEmitterPlugin, ExternalEmitterPlugin, + ExternalEventPlugin, SernEmitterPlugin, + SernEventPlugin, } from '../plugins/plugin'; -import type { CommandType } from './enums'; import type { Awaitable, ClientEvents } from 'discord.js'; +import type { EventType } from './enums'; export type SernEventCommand = Override< BaseModule, { name?: T; - type: CommandType.Sern; - onEvent: EventPlugin[]; + type: EventType.Sern; + onEvent: SernEventPlugin[]; plugins: SernEmitterPlugin[]; execute(...args: SernEventsMapping[T]): Awaitable; } @@ -24,9 +25,9 @@ export type DiscordEventCommand[]; - plugins: CommandPlugin[]; + type: EventType.Discord; + onEvent: DiscordEventCommand[]; + plugins: DiscordEmitterPlugin[]; execute(...args: ClientEvents[T]): Awaitable; } >; @@ -35,8 +36,8 @@ export type ExternalEventCommand = Override< BaseModule, { emitter: string; - type: CommandType.External; - onEvent: EventPlugin[]; + type: EventType.External; + onEvent: ExternalEventPlugin[]; plugins: ExternalEmitterPlugin[]; execute(...args: unknown[]): Awaitable; }