CreateUserCommand
Defined in: packages/builders/src/commands.ts:628
Builds a User context menu command (appears when right-clicking a user, type 2).
Example
Section titled “Example”new CreateUserCommand().setName("View Profile").toJSON()Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CreateUserCommand():
CreateUserCommand
Defined in: packages/builders/src/commands.ts:629
Returns
Section titled “Returns”CreateUserCommand
Overrides
Section titled “Overrides”CreateContextMenuCommand.constructor
Methods
Section titled “Methods”setContexts()
Section titled “setContexts()”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.
Parameters
Section titled “Parameters”contexts
Section titled “contexts”…number[]
Returns
Section titled “Returns”this
Throws
Section titled “Throws”For any other value.
Inherited from
Section titled “Inherited from”CreateContextMenuCommand.setContexts
setDefaultMemberPermissions()
Section titled “setDefaultMemberPermissions()”setDefaultMemberPermissions(
permissions):this
Defined in: packages/builders/src/commands.ts:592
Sets default member permissions required to see this command.
Parameters
Section titled “Parameters”permissions
Section titled “permissions”string | number | bigint | null
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”CreateContextMenuCommand.setDefaultMemberPermissions
setIntegrationTypes()
Section titled “setIntegrationTypes()”setIntegrationTypes(…
types):this
Defined in: packages/builders/src/commands.ts:600
Sets command integration types (0 guild install, 1 user install).
Parameters
Section titled “Parameters”…number[]
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”CreateContextMenuCommand.setIntegrationTypes
setName()
Section titled “setName()”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.
Parameters
Section titled “Parameters”string
Display name; 1-32 characters, mixed case and spaces allowed.
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If the name is empty/whitespace-only or exceeds 32 characters.
Inherited from
Section titled “Inherited from”CreateContextMenuCommand.setName
setNameLocalizations()
Section titled “setNameLocalizations()”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.
Parameters
Section titled “Parameters”localizations
Section titled “localizations”Record<string, string> | null
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”CreateContextMenuCommand.setNameLocalizations
setType()
Section titled “setType()”setType(
type):this
Defined in: packages/builders/src/commands.ts:567
Sets the command type: 2 = USER, 3 = MESSAGE.
Parameters
Section titled “Parameters”2 | 3
Returns
Section titled “Returns”this
Throws
Section titled “Throws”For any other type.
Inherited from
Section titled “Inherited from”CreateContextMenuCommand.setType
toJSON()
Section titled “toJSON()”toJSON():
Record<string,unknown>
Defined in: packages/builders/src/commands.ts:619
Serializes the command payload for the Discord API.
Returns
Section titled “Returns”Record<string, unknown>