Bot Playground/Examples/Region restart

From SmartBots Developers Docs
Jump to: navigation, search

The following script uses commands and events to work with region restarts:

  1. It restarts region
  2. Sleeps for 10 seconds
  3. Then cancels restart
  4. All restart events are being logged as well


console.log(`${} started`);

Bot.on("region_restart", (event) => {
	console.log(`region_restart:`, event);

Bot.on("region_restart_cancelled", (event) => {
	console.log(`region_restart_cancelled:`, event);

console.log("Region restart requested");

await sleep(10 * 1000);

console.log("Region restart cancelled");