I have a problem. I can execute everything, but when I try and type a command after the prefix “~”, it doesn’t recognize it. Like if I type “~help” in discord, it says in the error long cannot find “help.js” even though it’s there in the directory.
Note that the CommonJS method (require) it uses fs.resolve to figure out where you’re importing a file from. When importing a module it should not start with ./ or ../ or / as those three tells CommonJS that you are importing a file from your project and not a module from node_modules directory.
When importing a file from current directory simply use:
const mod = require("./filename.extension");
However, if you’re importing a javascript file the extension isn’t needed:
const mod = require("./filename");
The way of loading the file above will be the same as: