Writing Scripts
Scripts in Regularbot follow some common patterns to make it easy to write and deploy scripts.
Saved Data
Every script receives a saved data object that contains the data that was saved by the last execution of the script. This object is a strings to string json object. You should see the language docs for how to access the previous execution saved data and save new data for the next execution.
Output
Stdout of the script is sent to the subscribed users. If the script did not write anything to stdout, the output will be empty and no message will be sent to the users for that execution.
You can use stderr for writing logs. Logs does not sent to the users. They are used for debugging and monitoring the script.
If the script exit with non-zero exit code, the execution will be marked as failed. If the user is subscribed for the errors, the error will be sent to the users. Even though the stdout is not empty, users will not receive the output of the script.