process.exit

From SmartBots Developers Docs
Bot PlaygroundBuilt-in Functions
Revision as of 13:05, 1 July 2016 by Gg (Talk | contribs) (Created page with "{{DISPLAYTITLE:{{SUBPAGENAME}}}} <onlyinclude>Ends the execution of the program.</onlyinclude> By default, Play programs run forever, waiting for the incoming bot event, time...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Ends the execution of the program.

By default, Play programs run forever, waiting for the incoming bot event, timer event etc. You don't need to stop the program in explicit way. However, you may need to terminate your program, like as you press "Stop" command in Bot Playground interface.

exit();

Reference

This command accepts the following parameters:

Variable Required Description


Input:
--- this function does not require any arguments
Output:
result This function does not return anything

Examples

Bot.on("instant_message", function(event) {
  if(event.message == "secret string") {
    console.log("Received a secret string, program is terminating");
    exit();
  }