Interactions Overview
Rich interactions let users tap buttons, pick from dropdowns, or fill modals instead of typing long command arguments. Bot Creator resolves these through the interactionCreate event.
Interaction types
((interaction.kind)) |
Trigger |
|---|---|
command |
Slash command or context menu |
button |
Button click |
select |
Select menu choice |
modal |
Modal form submission |
autocomplete |
Slash option autocomplete |
Core variables
Every interaction exposes:
| Variable | Description |
|---|---|
((interaction.customId)) |
Developer-defined ID on the component |
((interaction.userId)) |
User who triggered the interaction |
((interaction.channelId)) |
Channel ID |
((interaction.guildId)) |
Server ID (empty in DMs) |
((interaction.messageId)) |
Message holding the component |
((opts.<name>)) |
Slash command option value (for user, channel, role and mentionable options the ID is ((opts.<name>.id))) |
Responding to an interaction
Unlike standard messages, an interaction expects an acknowledgment or response within 3 seconds.
In BDScript (BDFD)
Emitting text or embed content automatically sends the interaction reply. Use $ephemeral to make it visible only to the interacting user. Do not append $sendMessage in slash commands unless you need a separate message in the channel. Inside a BDFD script, read the component ID with $customID (it is an error outside a component or modal interaction): ((...)) text is not resolved in BDFD scripts.
$if[$customID==btn_verify]
$ephemeral
Verified! Your account has been unlocked.
$endif
In Blocks
Use the dedicated respondWithMessage action with the ephemeral checkbox:
{
"type": "respondWithMessage",
"payload": {
"content": "Verified! Your account has been unlocked.",
"ephemeral": true
}
}
In JavaScript (BDJS)
In BDJS scripts, use the global interaction object:
if (interaction.isButton()) {
await interaction.reply({ content: 'Clicked!', ephemeral: true });
}
See Components and interaction.
3. Read select values
| Select type | Getter |
|---|---|
| String select | $getStringSelectValue |
| User select | $getUserSelectUserId |
| Role select | $getRoleSelectRoleId |
| Channel select | $getChannelSelectChannelId |
Slash commands
Slash commands are interactions too. Read an option with $message[name] in BDScript (for a slash command it returns the option value), with ((opts.<name>)) in Blocks placeholders, or interaction.options.getString('name') in JavaScript.
The runner acknowledges a BDFD script before running it, except when the script source contains $newModal, $callWorkflow, $eval or $funcCall (see the execution model). See also $defer and the deferInteraction block.
Guides
| Guide | Topics |
|---|---|
| Handling rich interactions | Buttons, selects, modals, autocomplete |
| Building interactive buttons and select menus | Role assignment patterns |
Function reference
Browse the Components & Interactions category for all builder and getter functions.