Windows, Dialogs & Packets

2min read
Sheet 37 of 47 · Automation

What the API hands back when a bot has a menu or a dialog open, how to answer a dialog the way a client does, and how to send packets by hand.

Window payload

/win, /chat and /click return the open window like this:

{
  "title": "ʏᴏᴜʀ ɪꜱʟᴀɴᴅ",
  "titleRuns": [{ "t": "ʏ", "c": "#5ec8ff", "i": false }, { "t": "ᴏ", "c": "#67c2ff", "i": false }],
  "type": "minecraft:generic_9x6",
  "inventoryStart": 54,
  "slots": [
    {
      "slot": 21,
      "name": "white_banner",
      "count": 1,
      "custom": "Members",
      "lore": ["Your team, roles and invites.", " ", "» ᴄʟɪᴄᴋ ᴛᴏ ᴏᴘᴇɴ"],
      "nameRuns": [{ "t": "Members", "c": "#b48cff", "b": true, "i": false }],
      "loreRuns": [[{ "t": "Your team, roles and invites.", "c": "gray", "i": false }]],
      "profile": null,
      "glint": false,
      "components": ["custom_name", "lore", "tooltip_display"]
    }
  ]
}
  • name is the material id and custom is the display name as plain text. This matches the older node crew server, so its scripts keep working.
  • profile is a player head's textures value. A head given by name only (profile={name:"Notch"}) reaches the client without textures, so its profile is null.
  • glint is true for enchanted items or a glint override.
  • components lists the item's component types.

Runs

A run is a piece of text with one style. titleRuns, nameRuns and loreRuns split the text into runs. Style carries from parent to child the way the game does it.

KeyMeaning
ttext
ccolor, a name like gray or #rrggbb
bbold
iitalic
uunderlined
sstrikethrough

Dialog payload

/dialog returns {"packet":"show_dialog","at":<ms>,"dialog":{...}}. The dialog is the full definition as plain JSON: type, title, body, inputs and actions. A dialog the server only names from its registry comes back as {"id": n}.

{
  "type": "minecraft:multi_action",
  "title": { "text": "Island settings", "color": "#5EC8FF" },
  "body": { "type": "minecraft:plain_message", "contents": "Toggle each setting, then save." },
  "inputs": [{ "type": "minecraft:boolean", "key": "pvp", "label": { "text": "PvP", "color": "#FF6B6B" } }],
  "actions": [{ "label": { "text": "Save settings", "color": "#7BE08A" }, "action": { "type": "minecraft:dynamic/custom" } }],
  "columns": 1
}

/dialog returns null once the server clears the dialog.

Answering a dialog

Answer a dialog the way a client does with the answerDialog action:

curl -H "X-ITT-Token: $TOKEN" "localhost:8767/act?bot=X&action=answerDialog&button=Save&input.name=Nacht"
  • button picks the button by a label regex.
  • Each input.<key> is typed by the dialog's own input definition: text, boolean, number range, option.
  • It then sends the custom action or runs the command template.

dialogAction still sends a raw custom action. Scenarios check and answer dialogs too, see Styles & Dialogs.

Packets

EndpointParametersReturns
/packetbot=X / all / online / Test_*, type, json, count, delaysent and failed counts, and a log
/packet (raw)bot, id=0x3C, hex=00, count, delaywrites the id and payload past the codec
/packet/list, /packet/template?name=, /packet/sendcomposer metadata and send

/packet and /packet/send need the API token. See HTTP API.

Loading the index

Enter openUp Down moveEsc close