Skip to main content

Class: Subcommand<PreParseReturn, O>

subcommands/src.Subcommand

Type parameters

NameType
PreParseReturnextends Args = Args
Oextends Options = Options

Hierarchy

  • Command<PreParseReturn, O>

    Subcommand

Constructors

constructor

new Subcommand<PreParseReturn, O>(context, options)

Type parameters

NameType
PreParseReturnextends Args<PreParseReturn> = Args
Oextends SubcommandOptions<O> = SubcommandOptions

Parameters

NameType
contextPieceContext
optionsO

Overrides

Command<PreParseReturn, O\>.constructor

Defined in

projects/plugins/packages/subcommands/src/lib/Subcommand.ts:21

Properties

aliases

aliases: readonly string[]

Inherited from

Command.aliases

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:687


applicationCommandRegistry

Readonly applicationCommandRegistry: ApplicationCommandRegistry

Inherited from

Command.applicationCommandRegistry

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2145


caseInsensitiveSubcommands

caseInsensitiveSubcommands: boolean = false

Defined in

projects/plugins/packages/subcommands/src/lib/Subcommand.ts:19


description

description: string

Inherited from

Command.description

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2110


detailedDescription

detailedDescription: DetailedDescriptionCommand

Inherited from

Command.detailedDescription

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2120


enabled

enabled: boolean

Inherited from

Command.enabled

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:450


fullCategory

Readonly fullCategory: readonly string[]

Inherited from

Command.fullCategory

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2129


lexer

Private lexer: Lexer

Inherited from

Command.lexer

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2151


location

Readonly location: PieceLocation

Inherited from

Command.location

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:442


name

Readonly name: string

Inherited from

Command.name

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:446


options

Readonly options: O

Inherited from

Command.options

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:454


parsedSubcommandMappings

parsedSubcommandMappings: SubcommandMappingArray

Defined in

projects/plugins/packages/subcommands/src/lib/Subcommand.ts:18


preconditions

preconditions: PreconditionContainerArray

Inherited from

Command.preconditions

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2115


store

store: CommandStore

Inherited from

Command.store

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2105


strategy

strategy: IUnorderedStrategy

Inherited from

Command.strategy

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2134


typing

typing: boolean

Inherited from

Command.typing

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2140

Accessors

category

get category(): null | string

Returns

null | string

Inherited from

Command.category

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2173


container

get container(): Container

Returns

Container

Inherited from

Command.container

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:460


parentCategory

get parentCategory(): null | string

Returns

null | string

Inherited from

Command.parentCategory

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2191


subCategory

get subCategory(): null | string

Returns

null | string

Inherited from

Command.subCategory

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2182

Methods

#findSubcommand

Private #findSubcommand(mappings, expectedName): { defaultMatch: false = false; mapping: SubcommandMappingMethod } | { defaultMatch: true = true; mapping: null | SubcommandMappingMethod = foundDefault }

Parameters

NameType
mappingsSubcommandMappingMethod[]
expectedNamestring

Returns

{ defaultMatch: false = false; mapping: SubcommandMappingMethod } | { defaultMatch: true = true; mapping: null | SubcommandMappingMethod = foundDefault }

Defined in

projects/plugins/packages/subcommands/src/lib/Subcommand.ts:339


#handleChatInputInteractionRun

Private #handleChatInputInteractionRun(interaction, context, subcommand): Promise<void>

Parameters

NameType
interactionInteraction<CacheType>
contextChatInputCommandContext
subcommandSubcommandMappingMethod

Returns

Promise<void>

Defined in

projects/plugins/packages/subcommands/src/lib/Subcommand.ts:291


#handleMessageRun

Private #handleMessageRun(message, args, context, subcommand): Promise<void>

Parameters

NameType
messageMessage<boolean>
argsArgs
contextMessageCommandContext
subcommandSubcommandMappingMethod

Returns

Promise<void>

Defined in

projects/plugins/packages/subcommands/src/lib/Subcommand.ts:252


#supportsCommandType

Private #supportsCommandType(commandType): boolean

Parameters

NameType
commandType"messageRun" | "chatInputRun"

Returns

boolean

Defined in

projects/plugins/packages/subcommands/src/lib/Subcommand.ts:357


autocompleteRun

Optional autocompleteRun(interaction): unknown

Parameters

NameTypeDescription
interactionAutocompleteInteraction<CacheType>

Returns

unknown

Inherited from

Command.autocompleteRun

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2223


chatInputRun

chatInputRun(interaction, context): Promise<void>

Parameters

NameType
interactionInteraction<CacheType>
contextChatInputCommandContext

Returns

Promise<void>

Overrides

Command.chatInputRun

Defined in

projects/plugins/packages/subcommands/src/lib/Subcommand.ts:215


contextMenuRun

Optional contextMenuRun(interaction, context): unknown

Parameters

NameTypeDescription
interactionContextMenuCommandInteraction<CacheType>
contextContextMenuCommandContext

Returns

unknown

Inherited from

Command.contextMenuRun

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2210


messagePreParse

messagePreParse(message, parameters, context): Awaitable<PreParseReturn>

Parameters

NameTypeDescription
messageMessage<boolean>
parametersstring
contextMessageCommandContext

Returns

Awaitable<PreParseReturn>

Inherited from

Command.messagePreParse

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2164


messageRun

messageRun(message, args, context): Promise<void>

Parameters

NameType
messageMessage<boolean>
argsPreParseReturn
contextMessageCommandContext

Returns

Promise<void>

Overrides

Command.messageRun

Defined in

projects/plugins/packages/subcommands/src/lib/Subcommand.ts:127


onLoad

onLoad(): void

Returns

void

Overrides

Command.onLoad

Defined in

projects/plugins/packages/subcommands/src/lib/Subcommand.ts:108


onUnload

onUnload(): unknown

Returns

unknown

Inherited from

Command.onUnload

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:470


parseConstructorPreConditions

Protected parseConstructorPreConditions(options): void

Parameters

NameTypeDescription
optionsCommandOptions

Returns

void

Inherited from

Command.parseConstructorPreConditions

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2258


parseConstructorPreConditionsCooldown

Protected parseConstructorPreConditionsCooldown(options): void

Parameters

NameTypeDescription
optionsCommandOptions

Returns

void

Inherited from

Command.parseConstructorPreConditionsCooldown

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2288


parseConstructorPreConditionsNsfw

Protected parseConstructorPreConditionsNsfw(options): void

Parameters

NameTypeDescription
optionsCommandOptions

Returns

void

Inherited from

Command.parseConstructorPreConditionsNsfw

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2263


parseConstructorPreConditionsRequiredClientPermissions

Protected parseConstructorPreConditionsRequiredClientPermissions(options): void

Parameters

NameTypeDescription
optionsCommandOptions

Returns

void

Inherited from

Command.parseConstructorPreConditionsRequiredClientPermissions

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2276


parseConstructorPreConditionsRequiredUserPermissions

Protected parseConstructorPreConditionsRequiredUserPermissions(options): void

Parameters

NameTypeDescription
optionsCommandOptions

Returns

void

Inherited from

Command.parseConstructorPreConditionsRequiredUserPermissions

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2282


parseConstructorPreConditionsRunIn

Protected parseConstructorPreConditionsRunIn(options): void

Parameters

NameTypeDescription
optionsCommandOptions

Returns

void

Inherited from

Command.parseConstructorPreConditionsRunIn

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2270


registerApplicationCommands

Optional registerApplicationCommands(registry): Awaitable<void>

Parameters

NameTypeDescription
registryApplicationCommandRegistry

Returns

Awaitable<void>

Inherited from

Command.registerApplicationCommands

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2232


reload

reload(): Promise<void>

Returns

Promise<void>

Inherited from

Command.reload

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2249


supportsAutocompleteInteractions

supportsAutocompleteInteractions(): this is AutocompleteCommand

Returns

this is AutocompleteCommand

Inherited from

Command.supportsAutocompleteInteractions

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2248


supportsChatInputCommands

supportsChatInputCommands(): this is ChatInputCommand

Returns

this is ChatInputCommand

Overrides

Command.supportsChatInputCommands

Defined in

projects/plugins/packages/subcommands/src/lib/Subcommand.ts:123


supportsContextMenuCommands

supportsContextMenuCommands(): this is ContextMenuCommand

Returns

this is ContextMenuCommand

Inherited from

Command.supportsContextMenuCommands

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2244


supportsMessageCommands

supportsMessageCommands(): boolean

Returns

boolean

Overrides

Command.supportsMessageCommands

Defined in

projects/plugins/packages/subcommands/src/lib/Subcommand.ts:119


toJSON

toJSON(): CommandJSON

Returns

CommandJSON

Inherited from

Command.toJSON

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2227


unload

unload(): Promise<void>

Returns

Promise<void>

Inherited from

Command.unload

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:474