Nubis / Context menus
Build
Context menus
Commands in the right-click menu on users and messages.
Context menu commands live in menus/, one per file. Unlike slash commands, they're named by their name, which Discord shows as written — capitals and spaces are fine.
// menus/avatar.ts → Apps › Show avatar, on a user
import { userCommand } from "nubis";
export default userCommand({
name: "Show avatar",
ephemeral: true,
run: ({ target, reply }) =>
reply(`https://cdn.discordapp.com/avatars/${target.id}/${target.avatar}.png`),
});// menus/quote.ts → Apps › Quote, on a message
import { messageCommand } from "nubis";
export default messageCommand({
name: "Quote",
run: ({ target, reply }) => reply(`> ${target.content}\n— <@${target.author.id}>`),
});The context
| Field | User menus | Message menus |
|---|---|---|
target | The user (APIUser) | The message (APIMessage) |
targetMember | Their membership, in a server | — |
Both get reply, editReply, defer, showModal, api and interaction, and both take ephemeral, guards, middleware, defaultMemberPermissions, contexts, integrationTypes and nsfw.
Limits
Names are 1-32 characters. Discord allows an app 15 user menus and 15 message menus; Nubis checks the count and duplicate names when it registers them.
Menus are registered with your slash commands by nubis dev and nubis sync.