var trigger = button_click(Args{custom_id: "my_button"})
func main() {
send_text_message(Args{
channel_id: trigger.channel_id,
message_content: "Custom ID: " + trigger.custom_id,
})
}
Button Click
Triggers when a user clicks a button.
- Interaction trigger: the flow can reply to the user directly, with messages, modals and more.
Options
The custom ID of the button to listen for. Supports `*` wildcard matching (e.g. `ticket_*`, `*_approve`, or `ticket_*_approve`).
Example: my_button
Outputs
The custom ID of the button that was clicked.
Example: my_button
If the Custom ID input uses a single `*` wildcard, this is the matched portion of the clicked button Custom ID.
Example: 123
ID of the user who clicked the button.
Example: 123456789012345678
Username of the user who clicked the button.
Example: johndoe
Avatar URL of the user who clicked the button.
Example: https://cdn.discordapp.com/avatars/123/abc.png
Channel where the button was clicked.
Example: 123456789012345678
Server where the button was clicked.
Example: 123456789012345678
ID of the application that received this interaction.
Example: 123456789012345678
Unique interaction ID for this button click.
Example: 123456789012345678
Token for this interaction, useful for webhook follow-up/edit operations.
Example: aW50ZXJhY3Rpb25fdG9rZW4
Permissions the bot/application had in the interaction channel, as a Discord bitfield string.
Example: 274877990912
Discord locale of the user who clicked the button.
Example: en-US
Preferred locale of the server where the button was clicked, when available.
Example: en-US
Where the interaction was used (`server`, `bot_dm`, or `private_channel`).
Example: server
ID of the message the button is attached to.
Example: 123456789012345678
Use this trigger in our visual flow editor. Bots are hosted 24/7 for free on inventor.bot.
Advanced Documentation
This documentation can be useful when using code mode. View as Markdown
button_click- Interaction trigger: blocks that respond to interactions (replies, modals, ...) can be used in its flows.
Options
| Field | InventScript name | Value |
|---|---|---|
| Custom ID | custom_id | e.g. "my_button" |
Outputs
| Field | InventScript name | Value |
|---|---|---|
| Custom ID | custom_id | e.g. "my_button" |
| Wildcard Value | wildcard_value | e.g. "123" |
| User ID | user_id | e.g. "123456789012345678" |
| Username | username | e.g. "johndoe" |
| User Avatar URL | user_avatar | e.g. "https://cdn.discordapp.com/avatars/123/abc.png" |
| Channel ID | channel_id | e.g. "123456789012345678" |
| Server ID | server_id | e.g. "123456789012345678" |
| Application ID | application_id | e.g. "123456789012345678" |
| Interaction ID | interaction_id | e.g. "123456789012345678" |
| Interaction Token | interaction_token | e.g. "aW50ZXJhY3Rpb25fdG9rZW4" |
| App Permissions | app_permissions | e.g. "274877990912" |
| User Locale | user_locale | e.g. "en-US" |
| Server Locale | server_locale | e.g. "en-US" |
| Interaction Context | interaction_context | e.g. "server" |
| Message ID | message_id | e.g. "123456789012345678" |