Difference between revisions of "Bot Playground/Events/region restart"

From SmartBots Developers Docs
Jump to: navigation, search
(Created page with "{{DISPLAYTITLE:region_restart}} <onlyinclude>Fires when bot receives a region restart notification.</onlyinclude> <syntaxhighlight lang="javascript"> Bot.on("region_restart",...")
 
Line 35: Line 35:
 
});
 
});
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
Also see a [[Bot_Playground/Examples/Region_restart|complex region restart script]] in Examples.
  
 
{{NavMenu}}
 
{{NavMenu}}

Revision as of 18:07, 6 October 2022

Fires when bot receives a region restart notification.

Bot.on("region_restart", function(event) { ... });

Reference

This event comes with the following event object:

Variable Required Description
event object properties:
name The name of the event in this case region_restart
message The message of the region_restart
bot_uuid The UUID of the bot which receives the notification.
region_name The name of the region going to restart.
time_units Unit of Time in which region is going to restart:
  • Seconds
  • Minutes
time_left Amount of time till region restart based on time_units.
seconds_left Amount of time till region restart in seconds.

Comments

  • time_left contains time till restart in time_units
  • time_units are “Seconds”, “Minutes” - Unknown is sent when anything other is received.
  • seconds_left is time till restart in seconds

Example

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

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

Also see a complex region restart script in Examples.