On this page
Interactions Overview
Buttons, select menus, modals, and slash commands — how Bot Creator handles rich Discord interactions.
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 |
BDScript workflow
1. Build the UI
Use component builders to attach elements to a message:
2. Handle the callback
Route by ((interaction.customId)) in an event workflow:
$if[((interaction.customId))==btn_verify]
$sendResponse[Verified! // ephemeral]
$endif
See $sendResponse for direct interaction replies.
3. Read select values
| Select type | Getter |
|---|---|
| String select | $getStringSelectValue |
| User select | $getUserSelectUserId |
| Role select | $getRoleSelectRoleId |
| Channel select | $getChannelSelectChannelId |
JavaScript workflow
In BDJS scripts, use the global interaction object:
if (interaction.isButton()) {
await interaction.reply({ content: 'Clicked!', ephemeral: true });
}
See Components and interaction.
Slash commands
Slash commands are interactions too. Read options with $slashOption in BDScript or interaction.options.getString() in JavaScript.
For slow commands, call $defer first to avoid Discord’s 3-second timeout.
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.