Carbon
CoreClasses

Command

Represents a standard command that the user creates

Extends

Constructors

new Command()

new Command(): Command

Returns

Command

Inherited from

BaseCommand.constructor

Properties

PropertyModifierTypeDefault valueDescriptionOverridesInherited from
componentspublic() => BaseComponent[][]The components that the command is able to use. You pass these here so the handler can listen for them..-BaseCommand.components
contextspublicInteractionContextType[]undefinedBeta The contexts this command can be used in API types are not finalized-BaseCommand.contexts
deferpublicbooleanfalseWhether the command response should be automatically deferred-BaseCommand.defer
descriptionabstractstringundefinedA description of the command-BaseCommand.description
ephemeralpublicbooleanfalseWhether the command response should be ephemeral-BaseCommand.ephemeral
integrationTypespublicApplicationIntegrationType[]undefinedBeta The places this command can be used in API types are not finalized-BaseCommand.integrationTypes
modalspublic() => Modal[][]All the modals that the command is able to use. You pass these here so the handler can listen for them.-BaseCommand.modals
nameabstractstringundefinedThe name of the command (e.g. "ping" for /ping)-BaseCommand.name
options?publicCommandOptionsundefinedThe options that the user passes along with the command in Discord--
typepublicApplicationCommandTypeApplicationCommandType.ChatInputThe type of command, either ChatInput, User, or Message. User and Message are context menu commands. Default ChatInputBaseCommand.type-

Methods

autocomplete()

autocomplete(interaction): Promise<void>

The function that is called when the command's autocomplete is triggered.

Parameters

ParameterTypeDescription
interactionAutocompleteInteractionThe interaction that triggered the autocomplete

Returns

Promise<void>

Remarks

You are expected to override this function to provide your own autocomplete functionality.


run()

abstract run(interaction): Promise<void>

The function that is called when the command is ran

Parameters

ParameterTypeDescription
interactionCommandInteractionThe interaction that triggered the command

Returns

Promise<void>


serialize()

serialize(): RESTPostAPIChatInputApplicationCommandsJSONBody | RESTPostAPIContextMenuApplicationCommandsJSONBody

Internal

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

Returns

RESTPostAPIChatInputApplicationCommandsJSONBody | RESTPostAPIContextMenuApplicationCommandsJSONBody

Inherited from

BaseCommand.serialize


serializeOptions()

serializeOptions(): undefined | CommandOptions

Internal

Returns

undefined | CommandOptions

Overrides

BaseCommand.serializeOptions

On this page

Edit on GitHub