Bot Playground/Examples/Region restart
From SmartBots Developers Docs
The following script uses commands and events to work with region restarts:
- It restarts region
- Sleeps for 10 seconds
- Then cancels restart
- All restart events are being logged as well
Code
console.log(`${process.name} started`);
Bot.on("region_restart", (event) => {
console.log(`region_restart:`, event);
});
Bot.on("region_restart_cancelled", (event) => {
console.log(`region_restart_cancelled:`, event);
});
Bot.regionRestart(240);
console.log("Region restart requested");
await sleep(10 * 1000);
Bot.regionRestartCancel();
console.log("Region restart cancelled");