refactor: move and update things

This commit is contained in:
Jacob Nguyen
2023-05-03 21:02:51 -05:00
parent b7a13d6558
commit cae1f648f0
5 changed files with 100 additions and 76 deletions

View File

@@ -1,4 +1,4 @@
import type { CommandModuleDefs } from '../../types/module';
import type { CommandModule, CommandModuleDefs } from '../../types/module';
import type { CommandType, ModuleStore } from '../structures';
import type { Processed } from '../../types/handler';
/**
@@ -25,3 +25,16 @@ export class DefaultModuleManager implements ModuleManager {
strat(this.moduleStore);
}
}
export type ModuleGetter = (accessStrat: (ms: ModuleStore) => Processed<CommandModule>|undefined) => Processed<CommandModule>|undefined
export function createModuleGetter(moduleManager: ModuleManager) {
return (accessStrat: (ms: ModuleStore) => Processed<CommandModule>|undefined) => {
return moduleManager.get(accessStrat)
}
}
export function createModuleInserter(moduleManager: ModuleManager) {
return (insertStrat: (ms: ModuleStore) => void) => {
return moduleManager.set(insertStrat)
}
}