Commands & interactions
Context-menu Commands
Commands members run by right-clicking (or long-pressing) a person or a message.
Besides slash commands, a command can have kind: "user" or kind: "message". It then appears under Apps when a member right-clicks someone in that hub, or right-clicks a message (long-press on phones). They take no options — the target is the input.
json
[ { "name": "Report message", "description": "Report this message to the moderators", "kind": "message" }, { "name": "Show avatar", "description": "Show this member's avatar", "kind": "user" }]| Rule | Slash (chat) | Context menu |
|---|---|---|
| Name | a-z 0-9 _ -, 1–32 | Letters, numbers, spaces, _ and -, 1–32 (shown as the menu item) |
| Options | Up to 25 | None |
| Where | The / menu | Right-click → Apps (user: on members; message: on messages) |
| Interaction data | { name, options, resolved } | { name, kind, targetId, target: { user } | { message } } |
ts
if (d.type === "command" && d.data.kind === "message" && d.data.name === "Report message") { const m = d.data.target.message; // the message that was right-clicked await fileReport({ messageId: m.id, author: m.authorId, by: d.user.id }); await answer(d, { type: "reply", data: { content: "Reported — thank you.", ephemeral: true } });}if (d.type === "command" && d.data.kind === "user") { const u = d.data.target.user; // the member that was right-clicked await answer(d, { type: "reply", data: { content: u.avatarUrl ?? "No avatar", ephemeral: true } });}The target is validated: a user target must be a member of the hub; a message target must be in the channel where the menu was used and not deleted. requiredPermission works the same as for slash commands. In the portal: Commands → Type.