mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
revert: feat of allow constructable modules (#138)
Revert "feat: allow constructable modules (#133)"
This reverts commit 03936eb2ea.
This commit is contained in:
@@ -87,7 +87,7 @@ export default class ReadyHandler extends EventsHandler<{
|
||||
type: PluginType.Command;
|
||||
}[];
|
||||
}) {
|
||||
if ((mod.plugins || []).length === 0) {
|
||||
if (mod.plugins.length === 0) {
|
||||
return of({ mod, pluginRes: [] });
|
||||
}
|
||||
// modules with no event plugins are ignored in the previous
|
||||
|
||||
@@ -25,7 +25,7 @@ export function processCommandPlugins<T extends DefinedCommandModule>(
|
||||
wrapper: Wrapper,
|
||||
payload: { mod: T; absPath: string },
|
||||
) {
|
||||
return (payload.mod.plugins || []).map(plug => ({
|
||||
return payload.mod.plugins.map(plug => ({
|
||||
...plug,
|
||||
name: plug?.name ?? 'Unnamed Plugin',
|
||||
description: plug?.description ?? '...',
|
||||
|
||||
@@ -73,11 +73,6 @@ export function buildData<T>(commandDir: string): Observable<
|
||||
} catch {
|
||||
mod = (await import(`file:///` + absPath)).default;
|
||||
}
|
||||
|
||||
try {
|
||||
mod = new (mod as unknown as new (...args: unknown[]) => T)();
|
||||
} catch {}
|
||||
|
||||
if (mod !== undefined) {
|
||||
return Ok({ mod, absPath });
|
||||
} else return Err(SernError.UndefinedModule);
|
||||
|
||||
Reference in New Issue
Block a user