I have a node.js script labeled Index.js, I have 1 other file bot.js. Using Node.js how can I execute this file?
var fs = require('fs');
const commandFiles = fs.readdirSync('./users/commands').filter(file => file.endsWith('.js'));
fs.watch('./users', (eventType, filename) => {
if (eventType === "rename" && filename.includes("txt") != true) {
let data = fs.readFileSync('./package.json', "utf8");
console.log("called");
fs.mkdirSync(`./users/${filename}/commands`);
commandFiles.forEach(element => {
fs.writeFileSync(`./users/${filename}/commands/${element}`, data);
});
fs.writeFileSync(`./users/${filename}/package.json`, data);
/*
EXECUTE bot.js HERE
*/
}
});
module.exportsand call it?