Skip to content

Discord Component

The Discord component allows a script to post messages to a Discord channel. The target channel is defined by the user in the settings screen of Cereal.

Usage

When implementing your script's onStart, execute, or onFinish methods, you can access the Discord component through the provided ComponentProvider.

fun execute(provider: ComponentProvider) {
    val discord = provider.discord()

    // Send a simple text message
    discord.sendMessage("New items are available for purchase!")

    // Send a more complex message with a link
    discord.sendMessage("Payment required: https://payment-portal.com/checkout/12345")
}

Best Practices

Only use this component to send notifications that the user needs to be notified about, such as:

  • Links to payment URLs that require user action within a time limit
  • Notifications when a new product is published
  • Important status updates that require immediate attention

For regular status updates and non-urgent information, use the Logger component instead.