update locals api, docs, tests

This commit is contained in:
Jacob Nguyen
2024-06-14 20:27:23 -05:00
parent 2f778f4dc2
commit 90f5ea7bda
10 changed files with 90 additions and 43 deletions

View File

@@ -14,11 +14,10 @@ import type { Awaitable } from '../types/utility';
*/
export function commandModule(mod: InputCommand): Module {
const [onEvent, plugins] = partitionPlugins(mod.plugins);
return {
...mod,
onEvent,
plugins,
} as Module;
return { ...mod,
onEvent,
plugins,
locals: {} } as Module;
}
/**
@@ -29,7 +28,9 @@ export function commandModule(mod: InputCommand): 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, plugins } as Module;
return { ...mod,
plugins,
locals: {} } as Module;
}
/** Create event modules from discord.js client events,