Answer the question
In order to leave comments, you need to log in
Global.name = require("./name .js"); how to re-execute the script?
Hello.
There is an interval with which the muscle is hammered. Once the conditions are met, the script is run, global.botname= require("./botname .js"); . The bot copes with the task once. Then, after some time, I need to call it again, but everything hangs. It seems to me that I am killing global.botname incorrectly after executing(process.exit();), any ideas?
Answer the question
In order to leave comments, you need to log in
Design the bot correctly so that it has a constructor. Then call this constructor each time to create a new instance of the bot. And require connects the necessary file once and remembers it in the cache, if you execute it many times, many instances will not multiply.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question