Carbon
Core/Classes

BaseCommand

Represents the base data of a command that the user creates

Extended by

Constructors

Constructor

new BaseCommand(): BaseCommand

Returns

BaseCommand

Properties

PropertyModifierTypeDefault valueDescription
componentspublic() => BaseComponent[][]The components that the command is able to use. You pass these here so the handler can listen for them..
contextspublicInteractionContextType[]undefinedThe contexts this command can be used in
deferpublicbooleanfalseWhether the command response should be automatically deferred
descriptionabstractstringundefinedA description of the command
ephemeralpublicbooleanfalseWhether the command response should be ephemeral
integrationTypespublicApplicationIntegrationType[]undefinedThe places this command can be used in
modalspublic() => Modal[][]All the modals that the command is able to use. You pass these here so the handler can listen for them.
nameabstractstringundefinedThe name of the command (e.g. "ping" for /ping)
permission?publicArrayOrSingle<bigint>undefinedThe default permission that a user needs to have to use this command. This can be overridden by server admins.
typeabstractApplicationCommandTypeundefinedThe type of the command

Methods

serialize()

serialize(): RESTPostAPIChatInputApplicationCommandsJSONBody | RESTPostAPIContextMenuApplicationCommandsJSONBody

Internal

Serializes the command into a JSON object that can be sent to Discord

Returns

RESTPostAPIChatInputApplicationCommandsJSONBody | RESTPostAPIContextMenuApplicationCommandsJSONBody


serializeOptions()

abstract serializeOptions(): _AddUndefinedToPossiblyUndefinedPropertiesOfInterface<undefined | APIApplicationCommandOption[]>

Internal

Serializes the options of the command into a JSON object that can be sent to Discord

Returns

_AddUndefinedToPossiblyUndefinedPropertiesOfInterface<undefined | APIApplicationCommandOption[]>

On this page