Skip to content

CreateMessageCommand

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

Builds a Message context menu command (appears when right-clicking a message, type 3).

new CreateMessageCommand().setName("Translate Message").toJSON()

new CreateMessageCommand(): CreateMessageCommand

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

CreateMessageCommand

CreateContextMenuCommand.constructor

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.

CreateContextMenuCommand.setContexts


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

CreateContextMenuCommand.setDefaultMemberPermissions


setIntegrationTypes(…types): this

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

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

…number[]

this

CreateContextMenuCommand.setIntegrationTypes


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.

CreateContextMenuCommand.setName


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

CreateContextMenuCommand.setNameLocalizations


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.

CreateContextMenuCommand.setType


toJSON(): Record<string, unknown>

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

Serializes the command payload for the Discord API.

Record<string, unknown>

CreateContextMenuCommand.toJSON