Skip to main content
Discord event triggers connect your Studio automations directly to your bot’s interaction pipeline. Whether a user types a slash command, clicks a button in a bot message, submits a modal form, or simply joins your server, Studio can catch the event and execute your logic automatically. This page documents every Discord trigger block, its configuration fields, and the data fields you can read from each event.

Trigger Blocks

erlc_when_discord_event

Fires on raw Discord gateway events. Choose from messages, member changes, role/channel lifecycle events, reactions, voice state updates, and AutoMod actions.

erlc_when_slash_command

Fires when a user invokes a specific slash command your bot exposes. Supports option definitions via the SlashOptionsField.

erlc_when_discord_button

Fires when a user clicks a button component in any bot message. Matched by the button’s custom ID.

erlc_when_discord_modal

Fires when a user submits a modal (pop-up form). Matched by the modal’s custom ID.

erlc_when_discord_select

Fires when a user selects an option from a select menu component. Matched by the component’s custom ID.

erlc_when_discord_event — EVENT Values

erlc_when_slash_command

Set the COMMAND field to the exact slash command name (without the /) that should trigger this automation. Use the OPTIONS field (SlashOptionsField) to declare the options your command accepts — Studio passes each option’s value into the event payload so you can read them with erlc_discord_event_value.
Each unique slash command needs its own erlc_when_slash_command trigger block. You cannot use a wildcard here — keep your automations focused and easy to debug.

erlc_when_discord_button

Set the BUTTON_ID field to the custom ID you assigned to the button component when you created it. When a user clicks the button, Studio matches the ID and fires this automation. Always respond to button interactions promptly — Discord requires an acknowledgment within 3 seconds.

erlc_when_discord_modal

Set the CUSTOM_ID field to the custom ID of the modal you want to handle. The modal’s submitted field values are available via erlc_discord_event_value using the ModalValue, ModalValues, and related fields.

erlc_when_discord_select

Set the CUSTOM_ID field to the custom ID of the select menu component. Use SelectedValue to read a single selection or SelectedValues for multi-select menus.

Reading Discord Event Data

Use erlc_discord_event_value inside any Discord-triggered automation to extract data from the event payload. Select a field from the FIELD dropdown.
Not every field is populated for every event. For example, Emoji is only set for discord_reaction_add and discord_reaction_remove events. Reading an unpopulated field returns an empty string rather than an error.

Example Automation

The JSON below shows a slash command trigger that reads the invoked command name and sends a confirmation reply.

Common Patterns

1

Pick the right trigger type

Use erlc_when_slash_command for intentional user commands, erlc_when_discord_button for guided menu flows, erlc_when_discord_modal for collecting structured input, and erlc_when_discord_event for passive monitoring like logging joins or AutoMod actions.
2

Set your custom IDs consistently

The BUTTON_ID and CUSTOM_ID fields must match the IDs you set when building message components. Use a naming convention like btn_verify or modal_report to stay organised.
3

Read the data you need

Attach erlc_discord_event_value blocks and select the fields your logic requires. Store each value in a named variable for use in downstream action blocks.
4

Respond to interactions

Discord interactions (slash commands, buttons, modals, selects) require a response within 3 seconds. Always place a reply or defer action block early in your automation to avoid interaction timeouts.
If your automation does not acknowledge a slash command, button, modal, or select interaction within 3 seconds, Discord marks it as failed and shows an error to the user. Use a deferred response block if your logic takes time to complete.