Hessel
Hessel
Explore posts from servers
DIAdiscord.js - Imagine a boo! 👻
Created by Hessel on 8/17/2023 in #djs-questions
No roles getting returned from interaction
5 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Hessel on 3/11/2023 in #djs-questions
The application did not respond
10 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Hessel on 2/6/2023 in #djs-questions
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data are supported
Hi everyone, I'm trying to read all commands from my command's folder but I can't seem to get it to work.
const commands = [];
const cwd = process.cwd();
const commandsDir = join(cwd, './src/Commands');

for (const file of readdirSync(commandsDir)) {
const { default: Command } = await import(join(commandsDir, file));
commands.push(Command.data.toJSON());
client.commands.set(Command.data.name, Command);
}
const commands = [];
const cwd = process.cwd();
const commandsDir = join(cwd, './src/Commands');

for (const file of readdirSync(commandsDir)) {
const { default: Command } = await import(join(commandsDir, file));
commands.push(Command.data.toJSON());
client.commands.set(Command.data.name, Command);
}
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'd:' any help would be appreciated
2 replies