Class: SubCommandPluginCommand<ArgType, CommandType>
subcommands/src.SubCommandPluginCommand
Type parameters
Name | Type |
---|---|
ArgType | extends Args = Args |
CommandType | extends Command <ArgType > = Command <ArgType > |
Hierarchy
Command
<ArgType
>↳
SubCommandPluginCommand
Constructors
constructor
• new SubCommandPluginCommand<ArgType
, CommandType
>(context
, options
)
Type parameters
Name | Type |
---|---|
ArgType | extends Args <ArgType > = Args |
CommandType | extends Command <ArgType , CommandOptions , CommandType > = Command <ArgType , CommandOptions > |
Parameters
Name | Type |
---|---|
context | PieceContext |
options | SubCommandPluginCommandOptions <ArgType , Command <ArgType , CommandOptions >> |
Overrides
Command<ArgType\>.constructor
Defined in
projects/plugins/packages/subcommands/src/lib/SubCommandPluginCommand.ts:8
Properties
aliases
• aliases: readonly string
[]
The aliases for the piece.
Inherited from
Command.aliases
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:684
description
• description: string
A basic summary about the command
since
1.0.0
Inherited from
Command.description
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:770
detailedDescription
• detailedDescription: DetailedDescriptionCommand
Longer version of command's summary and how to use it
since
1.0.0
Inherited from
Command.detailedDescription
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:780
enabled
• enabled: boolean
Whether or not the piece is enabled.
Inherited from
Command.enabled
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:447
fullCategory
• Readonly
fullCategory: readonly string
[]
The full category for the command. Either an array of strings that denote every (sub)folder the command is in,
or null
if it could not be resolved automatically.
If this is null
for how you setup your code then you can overwrite how the fullCategory
is resolved by
extending this class and overwriting the assignment in the constructor.
since
2.0.0
Inherited from
Command.fullCategory
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:789
lexer
• Private
lexer: Lexer
The lexer to be used for command parsing
since
1.0.0
Inherited from
Command.lexer
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:806
location
• Readonly
location: PieceLocation
The location metadata for the piece's file.
Inherited from
Command.location
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:439
name
• Readonly
name: string
The name of the piece.
Inherited from
Command.name
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:443
options
• Readonly
options: CommandOptions
The raw options passed to this {@link Piece}
Inherited from
Command.options
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:451
preconditions
• preconditions: PreconditionContainerArray
The preconditions to be run.
since
1.0.0
Inherited from
Command.preconditions
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:775
store
• Readonly
store: Store
<Piece
<PieceOptions
>>
The store that contains the piece.
Inherited from
Command.store
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:435
strategy
• strategy: UnorderedStrategy
The strategy to use for the lexer.
since
1.0.0
Inherited from
Command.strategy
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:794
subCommands
• Readonly
subCommands: null
| SubCommandManager
<ArgType
, CommandType
>
Defined in
projects/plugins/packages/subcommands/src/lib/SubCommandPluginCommand.ts:6
typing
• typing: boolean
If {@link SapphireClient.typing} is true, it can be overridden for a specific command using this property, set via its options. Otherwise, this property will be ignored.
default
true
Inherited from
Command.typing
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:800
Accessors
category
• get
category(): null
| string
The main category for the command, if any.
This getter retrieves the first value of {@link Command.fullCategory}, if it has at least one item, otherwise it
returns null
.
note
You can set {@link Command.Options.fullCategory} to override the built-in category resolution.
Returns
null
| string
Inherited from
Command.category
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:828
container
• get
container(): Container
A reference to the {@link Container} object for ease of use.
see
container
Returns
Container
Inherited from
Command.container
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:457
parentCategory
• get
parentCategory(): null
| string
The parent category for the command.
This getter retrieves the last value of {@link Command.fullCategory}, if it has at least one item, otherwise it
returns null
.
note
You can set {@link Command.Options.fullCategory} to override the built-in category resolution.
Returns
null
| string
Inherited from
Command.parentCategory
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:846
subCategory
• get
subCategory(): null
| string
The sub-category for the command, if any.
This getter retrieves the second value of {@link Command.fullCategory}, if it has at least two items, otherwise
it returns null
.
note
You can set {@link Command.Options.fullCategory} to override the built-in category resolution.
Returns
null
| string
Inherited from
Command.subCategory
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:837
Methods
messageRun
▸ messageRun(message
, args
, context
): unknown
Parameters
Name | Type |
---|---|
message | Message <boolean > |
args | ArgType |
context | CommandContext |
Returns
unknown
Overrides
Command.messageRun
Defined in
projects/plugins/packages/subcommands/src/lib/SubCommandPluginCommand.ts:14
onLoad
▸ onLoad(): unknown
Per-piece listener that is called when the piece is loaded into the store. Useful to set-up asynchronous initialization tasks.
Returns
unknown
Inherited from
Command.onLoad
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:462
onUnload
▸ onUnload(): unknown
Per-piece listener that is called when the piece is unloaded from the store. Useful to set-up clean-up tasks.
Returns
unknown
Inherited from
Command.onUnload
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:467
parseConstructorPreConditions
▸ Protected
parseConstructorPreConditions(options
): void
Parses the command's options and processes them, calling {@link Command#parseConstructorPreConditionsRunIn}, {@link Command#parseConstructorPreConditionsNsfw}, {@link Command#parseConstructorPreConditionsRequiredClientPermissions}, and {@link Command#parseConstructorPreConditionsCooldown}.
since
2.0.0
Parameters
Name | Type | Description |
---|---|---|
options | CommandOptions | The command options given from the constructor. |
Returns
void
Inherited from
Command.parseConstructorPreConditions
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:865
parseConstructorPreConditionsCooldown
▸ Protected
parseConstructorPreConditionsCooldown(options
): void
Appends the Cooldown
precondition when {@link Command.Options.cooldownLimit} and
{@link Command.Options.cooldownDelay} are both non-zero.
Parameters
Name | Type | Description |
---|---|---|
options | CommandOptions | The command options given from the constructor. |
Returns
void
Inherited from
Command.parseConstructorPreConditionsCooldown
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:895
parseConstructorPreConditionsNsfw
▸ Protected
parseConstructorPreConditionsNsfw(options
): void
Appends the NSFW
precondition if {@link Command.Options.nsfw} is set to true.
Parameters
Name | Type | Description |
---|---|---|
options | CommandOptions | The command options given from the constructor. |
Returns
void
Inherited from
Command.parseConstructorPreConditionsNsfw
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:870
parseConstructorPreConditionsRequiredClientPermissions
▸ Protected
parseConstructorPreConditionsRequiredClientPermissions(options
): void
Appends the ClientPermissions
precondition when {@link Command.Options.requiredClientPermissions} resolves to a
non-zero bitfield.
Parameters
Name | Type | Description |
---|---|---|
options | CommandOptions | The command options given from the constructor. |
Returns
void
Inherited from
Command.parseConstructorPreConditionsRequiredClientPermissions
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:883
parseConstructorPreConditionsRequiredUserPermissions
▸ Protected
parseConstructorPreConditionsRequiredUserPermissions(options
): void
Appends the UserPermissions
precondition when {@link Command.Options.requiredUserPermissions} resolves to a
non-zero bitfield.
Parameters
Name | Type | Description |
---|---|---|
options | CommandOptions | The command options given from the constructor. |
Returns
void
Inherited from
Command.parseConstructorPreConditionsRequiredUserPermissions
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:889
parseConstructorPreConditionsRunIn
▸ Protected
parseConstructorPreConditionsRunIn(options
): void
Appends the DMOnly
, GuildOnly
, NewsOnly
, and TextOnly
preconditions based on the values passed in
{@link Command.Options.runIn}, optimizing in specific cases (NewsOnly
+ TextOnly
= GuildOnly
; DMOnly
+
GuildOnly
= null
), defaulting to null
, which doesn't add a precondition.
Parameters
Name | Type | Description |
---|---|---|
options | CommandOptions | The command options given from the constructor. |
Returns
void
Inherited from
Command.parseConstructorPreConditionsRunIn
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:877
preParse
▸ preParse(message
, parameters
, context
): Awaitable
<ArgType
>
The pre-parse method. This method can be overridden by plugins to define their own argument parser.
Parameters
Name | Type | Description |
---|---|---|
message | Message <boolean > | The message that triggered the command. |
parameters | string | The raw parameters as a single string. |
context | CommandContext | The command-context used in this execution. |
Returns
Awaitable
<ArgType
>
Inherited from
Command.preParse
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:819
reload
▸ reload(): Promise
<void
>
Reloads the piece by loading the same path in the store.
Returns
Promise
<void
>
Inherited from
Command.reload
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:475
run
▸ Optional
run(message
, args
, context
): unknown
Executes the command's logic.
deprecated
Use messageRun
instead.
Parameters
Name | Type | Description |
---|---|---|
message | Message <boolean > | The message that triggered the command. |
args | ArgType | The value returned by {@link Command.preParse}, by default an instance of {@link Args}. |
context | CommandContext | - |
Returns
unknown
Inherited from
Command.run
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:905
toJSON
▸ toJSON(): CommandJSON
Defines the JSON.stringify behavior of the command.
Returns
CommandJSON
Inherited from
Command.toJSON
Defined in
node_modules/@sapphire/framework/dist/index.d.ts:856
unload
▸ unload(): Promise
<void
>
Unloads and disables the piece.
Returns
Promise
<void
>
Inherited from
Command.unload
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:471