'Why can't it locate the directory?
Was cooding a command handler in discord.js but ran into some trouble along the way, from my limited knowledge in javascript and discord.js the code should at least be able to find the directory.
Said code that's causing the headache:
const cmdFiles = fs.readdirSync('../cmds/').filter(file => file.endsWith('.js'));
for(const file of cmdFiles) {
console.log("hej");
console.log(file);
const cmd = require(`../cmds/${file}`);
client.cmds.set(cmd.name, cmd);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

