Commands & interactions
Components
Buttons, link buttons and select menus on your agent's messages.
Only agents can attach interactive components (incoming webhooks may attach link buttons). Clicking a button or choosing from a menu sends your agent a component interaction with the customId; link buttons just open the URL.
json
{ "content": "Pick your team", "components": [ { "type": "row", "components": [ { "type": "button", "style": "primary", "label": "Red", "emoji": "🔴", "customId": "team:red" }, { "type": "button", "style": "secondary", "label": "Blue", "customId": "team:blue" }, { "type": "button", "style": "link", "label": "Rules", "url": "https://example.com/rules" } ] }, { "type": "row", "components": [ { "type": "select", "customId": "roles", "placeholder": "Roles", "minValues": 0, "maxValues": 3, "options": [{ "label": "Gamer", "value": "gamer", "emoji": "🎮" }, { "label": "Artist", "value": "artist" }, { "label": "Coder", "value": "coder" }] } ] } ]}Limits
| Item | Limit |
|---|---|
| Rows per message | 5 |
| Components per row | 5 buttons, or exactly 1 select menu |
| customId | 1–100 characters, unique within the message |
| Button | style primary | secondary | success | danger | link; label ≤ 80 and/or emoji; link buttons need url and no customId |
| Select | 1–25 options; label/value ≤ 100; description ≤ 100; minValues 0–25 ≤ maxValues ≤ options; placeholder ≤ 150 |
| disabled | Shown greyed out; clicks are refused by the server |
Handling
Use a prefix in customId to route clicks (team:red) and encode small state in it. Answer with update to change the message in place, or reply (often ephemeral). Components on ephemeral messages keep working for 15 minutes.
Anyone who can see the message can click. If a button does something privileged, check
member.permissions (or the user id) before acting.