Scripting

JavaScript

Write automation logic in JavaScript with full CPH access.

Overview

JavaScript scripts run inside the FaustBot scripting runtime and can call any CPH API method available to actions and triggers.

Setup

  • Enable the JavaScript scripting plugin in settings.
  • Create a new script action and select JavaScript as the language.
  • Use the CPH API for integrations, triggers, and variables.

Examples

Basic JavaScript script
// Read a variable and send a message
const user = args["user"];
const points = CPH.GetUserVar(user, "points", 0);
CPH.SendMessage(user + " has " + points + " points");

See the getting started guide for multi-language examples.

Tips

  • Keep scripts focused and reusable for easier maintenance.
  • Use variables to share state across actions.
  • Log outputs during testing to validate results.