ElektraE
Denoβ€’15mo agoβ€’
4 replies
Elektra

dynamic import fail

alright, so i had another issue aside from this but I figured it out, though its a very clearly ugly fix... just ignore that..
Anyways, this hangs on the import statement...
for (const folder of commandFolders) {
    //
    const commandsPath = path.join(foldersPath, folder);
    const commandFiles = fs.readdirSync(commandsPath).filter((file) =>
        //Filter any and all files
        // that end with ts
        file.endsWith(".ts")
    );
    for (const file of commandFiles) {
        //Join Commands/x with /file.tx
        const filePath = path.join(commandsPath, file);

        //import the command from file
        // deno-lint-ignore prefer-const
        let command = await import("file://" + filePath) as BotCommand;

        //Add command to the list
        commands.push(command.data.toJSON());
    }
}
image.png
Was this page helpful?