···2323The command loader walks a directory and stores data from any file exporting an object that follows the Command type structure.
24242525## Handlers
2626-Handlers are static classes, which receive exported data from Loaders, though not directly, as Loader data is usually fetched by a Registry, and the Registry invokes a Handler to get data into our queue system, more on that later.
2626+Handlers are static classes, which are invoked, usually on discord events or interactions.
27272828-Each handler has an `invoke` method, which takes JSON data, though it must always use the common exported JSON structure provided by Loaders.
2828+Each handler has an `invoke` method, which is the one I mentioned calling above.
29293030-Any data filtering or mapping is then run in the background by the invoked Handler, which ultimately pushes data to the queue, and triggers a "handler::postInvoke" event afterward.
3030+The handler then queries the core registry and all other registries afterward, to find a fitting execution target.
3131+3232+It's important to note that only repositories marked as active are taken into account.
31333234@Todo: document Handler lifecycle events
3335
···2323 * Recursively collects data from a directory based on the path specificed in dataSource property.
2424 */
2525 public async collect() {
2626- const glob = new Glob(`**.ts`);
2626+ const glob = new Glob(`**/**.ts`);
2727 const iterator = glob.scan(this.dataSource);
28282929 for await (const path of iterator) {
+12-2
src/core/Registry.ts
···11-import type { Module } from "../loaders/ModuleLoader"
11+import { ModuleLoader, type Module } from "../loaders/ModuleLoader"
2233export interface IRegistry {
44+ dataSource: string
45 store: Module[]
5667 collect: () => Promise<void>
···1011}
11121213export class Registry implements IRegistry {
1414+ public dataSource: string;
1315 public store: Module[] = [];
14161515- public async collect() { }
1717+ public constructor(dataSource: string) {
1818+ this.dataSource = dataSource;
1919+ }
2020+2121+ // @Todo: finish this implementation
2222+ public async collect() {
2323+ const moduleLoader = await (new ModuleLoader(this.dataSource)).collect();
2424+ console.log(moduleLoader.getJSON()[0]?.exports);
2525+ }
16261727 public async prepare() { }
1828
+3-1
src/core/VoidyClient.ts
···77 public constructor(options: ClientOptions) {
88 super(options);
991010- this.registries = [new Registry()];
1010+ this.registries = [
1111+ new Registry(`${process.cwd()}/src/modules`),
1212+ ];
1113 }
12141315 public start(token: string) {