Components
With components your script can access core functionality of the Cereal application. The onStart, execute and
onFinish method in your Scripts' implementation contain a ComponentProvider which gives access to these components.
Available Components
Each component provides specific functionality to your script:
- Logger - Log output to the Cereal application
- Discord - Post messages to a Discord channel
- License - Verify if the user has a valid license
- Notification - Send desktop notifications to the user
- Preference - Store and retrieve persistent data
- Script Launcher - Start child scripts from your main script
- User Interaction - Ask the user for input during execution
Accessing Components
Every component can be accessed through the ComponentProvider that's passed to your script's methods:
fun execute(provider: ComponentProvider) {
// Access different components
val logger = provider.logger()
val discord = provider.discord()
val license = provider.license()
val notification = provider.notification()
val preference = provider.preference()
val scriptLauncher = provider.scriptLauncher()
val userInteraction = provider.userInteraction()
// Use components as needed
logger.info("Script started")
// Store preferences
preference.putString("lastRun", LocalDateTime.now().toString())
}
Refer to each component's dedicated documentation page for detailed usage instructions and examples.