let import error by itself
This commit is contained in:
parent
918e8aa941
commit
7547e6af57
@ -171,9 +171,7 @@ class Controller extends EventEmitter
|
||||
this.#commands = [];
|
||||
for (const file of files)
|
||||
{
|
||||
const imported = await import(`file://${file}`).catch(() => null);
|
||||
if (!imported)
|
||||
throw new Error(`Invalid file ${file}`);
|
||||
const imported = await import(`file://${file}`);
|
||||
const cmd = imported.default;
|
||||
if (typeof cmd !== 'function')
|
||||
return void this.#logger.warn(`Attempted to load an invalid command: ${file}`);
|
||||
|
Loading…
Reference in New Issue
Block a user