diff --git a/src/core/modules.ts b/src/core/modules.ts index 4de590af..d31e5402 100644 --- a/src/core/modules.ts +++ b/src/core/modules.ts @@ -26,7 +26,7 @@ export function commandModule(mod: InputCommand): Module { * The wrapper function to define event modules for sern * @param mod */ -export function eventModule(mod: InputEvent): Module { +export function eventModule(mod: InputEvent): Module { const [onEvent, plugins] = partitionPlugins(mod.plugins); if(onEvent.length !== 0) throw Error("Event modules cannot have ControlPlugins"); return { ...mod, @@ -35,8 +35,9 @@ export function eventModule(mod: InputEvent): Module { } /** Create event modules from discord.js client events, - * This is an {@link eventModule} for discord events, - * where typings can be very bad. + * This was an {@link eventModule} for discord events, + * where typings were bad. + * @deprecated Use {@link eventModule} instead * @param mod */ export function discordEvent(mod: { diff --git a/src/types/core-modules.ts b/src/types/core-modules.ts index 48a7c8a5..7212e5a8 100644 --- a/src/types/core-modules.ts +++ b/src/types/core-modules.ts @@ -167,9 +167,9 @@ export interface CommandModuleDefs { [CommandType.Modal]: ModalSubmitCommand; } -export interface EventModuleDefs { +export interface EventModuleDefs { [EventType.Sern]: SernEventCommand; - [EventType.Discord]: DiscordEventCommand; + [EventType.Discord]: DiscordEventCommand; [EventType.External]: ExternalEventCommand; } @@ -186,12 +186,12 @@ export interface SernAutocompleteData type CommandModuleNoPlugins = { [T in CommandType]: Omit; }; -type EventModulesNoPlugins = { - [T in EventType]: Omit ; +type EventModulesNoPlugins = { + [T in EventType]: Omit[T], 'plugins' | 'onEvent' | 'meta' | 'locals'> ; }; -export type InputEvent = { - [T in EventType]: EventModulesNoPlugins[T] & { +export type InputEvent = { + [T in EventType]: EventModulesNoPlugins[T] & { once?: boolean; plugins?: InitPlugin[] };