diff --git a/src/handler/events/readyHandler.ts b/src/handler/events/readyHandler.ts index 83e02dc..1a5318e 100644 --- a/src/handler/events/readyHandler.ts +++ b/src/handler/events/readyHandler.ts @@ -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 diff --git a/src/handler/events/userDefinedEventsHandling.ts b/src/handler/events/userDefinedEventsHandling.ts index 5293520..fa02698 100644 --- a/src/handler/events/userDefinedEventsHandling.ts +++ b/src/handler/events/userDefinedEventsHandling.ts @@ -25,7 +25,7 @@ export function processCommandPlugins( 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 ?? '...', diff --git a/src/handler/utilities/readFile.ts b/src/handler/utilities/readFile.ts index 47497bf..1f12eee 100644 --- a/src/handler/utilities/readFile.ts +++ b/src/handler/utilities/readFile.ts @@ -73,11 +73,6 @@ export function buildData(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);