HelloWorld Posted February 21, 2020 Report Share Posted February 21, 2020 How do I get the direct detection of the bot when I change the content of the /message file. I do not want to close and open the bot and enter the guard code. Quote Link to comment Share on other sites More sharing options...
apibot Posted June 5, 2021 Report Share Posted June 5, 2021 On 2/22/2020 at 7:12 AM, HelloWorld said: How do I get the direct detection of the bot when I change the content of the /message file. I do not want to close and open the bot and enter the guard code. is your /message file a .json or .js. Listen for file changes, it it's a .json you can just re-require it. I'm not sure if it works with .js file. Quote Link to comment Share on other sites More sharing options...
Jack Nolddor Posted August 21, 2021 Report Share Posted August 21, 2021 You can even run your bot under pm2 and use Watch & Restart features: - Link: https://pm2.keymetrics.io/docs/usage/watch-and-restart/ - Further Info: https://stackoverflow.com/questions/29766723/how-to-automatically-reload-node-js-project-when-using-pm2#30695750 Quote Link to comment Share on other sites More sharing options...
venfiw Posted August 31, 2021 Report Share Posted August 31, 2021 var itemlist = require('./itemlist/itemlist.json'); client.on('friendMessage#'+Config.admin, function(steamID, message) { if (message.toUpperCase().indexOf("@changejson") >= 0) { delete require.cache[require.resolve("./itemlist/itemlist.json")] itemlist = require('./itemlist/itemlist.json').data; } }); here is code when bot get your message, it will reset itemlist to new Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.