Skip to content

CreateContextMenuCommand

Defined in: packages/builders/src/commands.ts:561

Builder for application commands that appear in right-click context menus. Example: new CreateContextMenuCommand().setName("x").setType(2).

new CreateContextMenuCommand(type?): CreateContextMenuCommand

Defined in: packages/builders/src/commands.ts:563

2 | 3

CreateContextMenuCommand

setContexts(…contexts): this

Defined in: packages/builders/src/commands.ts:605

Sets where the command can be used: 0 guilds, 1 the bot’s DMs, 2 other DMs.

…number[]

this

For any other value.


setDefaultMemberPermissions(permissions): this

Defined in: packages/builders/src/commands.ts:592

Sets default member permissions required to see this command.

string | number | bigint | null

this


setIntegrationTypes(…types): this

Defined in: packages/builders/src/commands.ts:600

Sets command integration types (0 guild install, 1 user install).

…number[]

this


setName(name): this

Defined in: packages/builders/src/commands.ts:581

Sets the command name (shown in the right-click menu). Unlike CHAT_INPUT commands, USER (type 2) and MESSAGE (type 3) context-menu command names may contain uppercase letters and spaces, so no lowercase/charset validation is applied here — only Discord’s 1-32 length limit and a non-empty (non-whitespace) requirement are enforced.

string

Display name; 1-32 characters, mixed case and spaces allowed.

this

If the name is empty/whitespace-only or exceeds 32 characters.


setNameLocalizations(localizations): this

Defined in: packages/builders/src/commands.ts:611

Sets the name shown per locale, e.g. { "es-ES": "Ver perfil" }; null clears it.

Record<string, string> | null

this


setType(type): this

Defined in: packages/builders/src/commands.ts:567

Sets the command type: 2 = USER, 3 = MESSAGE.

2 | 3

this

For any other type.


toJSON(): Record<string, unknown>

Defined in: packages/builders/src/commands.ts:619

Serializes the command payload for the Discord API.

Record<string, unknown>