i'm trying to run a node script into a node script like, my main script is called index.js and the script i want to run is called test.js so, i run my main script on cmd with: node index.js but, i want when i do the command (prefix + "test") it's run my script text in my folder
here is my command:
client.on("message", message =>
{
let cmd = message.content.split(" ")[0]
cmd = cmd.slice(prefix.length)
let args = message.content.split(" ").slice(1)
if (cmd == "test")
{
const testscript = require("./extensions/test.js")
//code for run it
}
});
thanks in advance !
test.jsfile exporting any functions that you can run? @Randytest.js, e.g., itsmodule.exports, like any other JS code. If you want to pretend you're executing it from the command line that's a different thing--and likely not necessary.