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",...")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE:region_restart}}
 
{{DISPLAYTITLE:region_restart}}
<onlyinclude>Fires when bot receives a region restart notification.</onlyinclude>
+
<onlyinclude>Fires when bot receives a region restart notification. {{NotAvailableForQB}}</onlyinclude>
  
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
Line 35: Line 35:
 
});
 
});
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
Also see a [[Bot_Playground/Examples/Region_restart|complex region restart script]] in Examples.
  
 
{{NavMenu}}
 
{{NavMenu}}

Latest revision as of 07:52, 12 October 2022

Fires when bot receives a region restart notification. Not available for QubicBot yet (?)

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.