Commands & interactions
Commands
Slash commands, interactions and components.
Members type / to find commands. Voznest validates every parameter and permission, then gives the handling agent an INTERACTION_CREATE with a token. Answer within 5 seconds (or defer and answer within 15 minutes).
Global commands reach every hub the project is installed in; hub commands exist only in one hub. Commands have a group and a position (the order in the / menu) and can carry localized descriptions shown according to the member's language.
Declaring commands
[ { "name": "remind", "description": "Remind yourself later", "options": [ { "type": "string", "name": "what", "description": "What to remember", "required": true, "maxLength": 200 }, { "type": "integer", "name": "minutes", "description": "In how many minutes", "required": true, "minValue": 1, "maxValue": 1440 } ] }, { "name": "clear", "description": "Delete recent messages", "requiredPermission": "manageMessages", "options": [ { "type": "integer", "name": "count", "description": "How many", "required": true, "minValue": 1, "maxValue": 50 } ] }]| Option type | Value you receive | Validation by Voznest |
|---|---|---|
string | text | maxLength (≤ 6000), choices (≤ 25) |
integer | whole number | minValue / maxValue, choices |
number | number | minValue / maxValue, choices |
boolean | true / false | — |
user | user id (+ resolved.users) | must be a member of the hub |
channel | channel id (+ resolved.channels) | must be a channel of the hub |
role | role id (+ resolved.roles) | must be a role of the hub |
| Limit | Value |
|---|---|
| Commands per scope (global, or per hub) | 100 |
| Name | a-z 0-9 _ -, 1–32 (context-menu commands: see Context menus) |
| Description | 1–100 characters; up to 30 localized descriptions |
| Options per command | 25 — required options first, unique names |
| requiredPermission | any key from the Permissions Reference |
Replace the whole global list with PUT /applications/:id/commands, or one hub's list with PUT /applications/:id/servers/:hubId/commands. From CI, use an API key with PUT /projects/@self/commands.
Publishing and versions
Each publish in the portal stores a snapshot. Roll back to any previous version from Commands → Versions; the rollback itself is a new version, so nothing is lost.
Answering
// Answer every interaction your bot receives.gateway.on("event", async ({ t, d }) => { if (t !== "INTERACTION_CREATE") return; const reply = (type, data) => fetch(`${API}/api/v1/interactions/${d.id}/${d.token}/callback`, { method: "POST", headers: { ...auth, "Content-Type": "application/json" }, body: JSON.stringify({ type, data }), }); if (d.type === "command" && d.data.name === "vote") { return reply("reply", { embeds: [{ title: "Pizza or tacos?", color: "#7c5cff" }], components: [{ type: "row", components: [ { type: "button", style: "primary", label: "Pizza", emoji: "🍕", customId: "vote:pizza" }, { type: "button", style: "success", label: "Tacos", emoji: "🌮", customId: "vote:tacos" }, ] }], }); } if (d.type === "component" && d.data.customId.startsWith("vote:")) { return reply("reply", { content: `You picked ${d.data.customId.slice(5)}!`, ephemeral: true }); }});replyPost a message in the channel (content, embeds, components). Add ephemeral: true to show it only to the member. Can be called again as a follow-up for 15 minutes.
deferAcknowledge now (the member sees “… is working on it”) and reply later within 15 minutes.
updateComponent interactions only: edit the message the button or menu belongs to.
modalFirst answer only: open a form (1–5 text fields). The submission arrives as a new modal_submit interaction.
Components
{ "components": [ { "type": "row", "components": [ { "type": "button", "style": "primary | secondary | success | danger", "label": "Accept", "emoji": "✅", "customId": "accept" }, { "type": "button", "style": "link", "label": "Docs", "url": "https://example.com" } ] }, { "type": "row", "components": [ { "type": "select", "customId": "color", "placeholder": "Pick colors", "minValues": 1, "maxValues": 2, "options": [{ "label": "Violet", "value": "violet", "emoji": "💜" }, { "label": "Cyan", "value": "cyan" }] } ] } ]}Each environment is answered by its own agent: a command used in a test hub goes to the Development or Staging agent installed there, never to Production. Full details of the lifecycle, forms and right-click commands: Interactions, Modals, Context menus.