Button Click
Triggers when a button below a message is clicked.
This trigger is based on Discord event InteractionCreate.
Inputs
Button ID
The button ID that you want to monitor for clicks.
Examples:
- This trigger with the Button ID of
cool-button
would only trigger for buttons with the ID ofcool-button
- If the Button ID was
button-*
it would trigger forbutton-yellow
,button-blue
, and anything else that started withbutton-
Outputs
Interaction ID
The interaction ID of the interaction.
Example: 123456789012345678
Interaction Token
The token of the interaction.
Example: abCdeF123gHiJkLmNoPqRsTuVwXyZ0123456789
Server ID
The server ID where the autocomplete interaction is being run.
Example: 123456789012345678
Channel ID
The server ID where the autocomplete interaction is being run.
Example: 123456789012345678
Executing User ID
The ID of the user that is running the command with the autocomplete option.
Example: 123456789012345678
Button ID
The complete button ID that was clicked.
Example: button-yellow
Message ID
The message ID that the button is attached to.
Example: 123456789012345678
Context Type
The context type of the command.
Example: Server
, DM
App Permissions
What permissions the bot application has in the context type.
Example: 2251799813685247
\
More information
The Button pressed trigger supports prefixing meaning you can have many paths (buttons) triggering the same flow and make the one flow. The following examples can be used and modified for use with the dropdown and modal trigger
Use Cases
Button prefixes can be used for anything from a simple action like pinging a user to more advanced actions like transferring data between flows
Examples
For the following examples, we are going to assume a prefix of "`prefix`" with the goal of kicking or banning a server member
A slash command with a select user dropdown was used and a user with the ID of 1250528195858665493
was selected. From there, the slash command provides 2 buttons with the following IDs using the following format; {prefix}*{action}*{user}
-
prefix*kick*1250528195858665493
-
prefix*ban*1250528195858665493
In both buttons, the prefix and user are the same with the difference being the action. This means you can easily get the action by putting the Button ID into a String Split List block
If the ban button is pressed, the String Split List outputs will be as follows
String 1) prefix*
String 2) ban
String 3) 1250528195858665493
Using the outputs (String 2 in this case), we can select a different action to preform depending on the specific button pressed all from within the same flow by using an If Statement. For banning a member you would want to check if the second string is equal to "ban" then execute a Ban Server Member block with the third string (User ID) in the server the button was pressed in and send a reply