Skip to main content

Interface: CommandOptions

The Command options.

Since

1.0.0

Extends

  • Options.FlagStrategyOptions

Properties

cooldownDelay?

optional cooldownDelay: number

The time in milliseconds for the cooldown entries to reset, if set to a non-zero value alongside CommandOptions.cooldownLimit, the Cooldown precondition will be added to the list.

Since

2.0.0

Default

0

Defined in

projects/framework/src/lib/types/CommandTypes.ts:146


cooldownFilteredUsers?

optional cooldownFilteredUsers: string[]

The users that are exempt from the Cooldown precondition. Use this to filter out someone like a bot owner

Since

2.0.0

Default

undefined

Defined in

projects/framework/src/lib/types/CommandTypes.ts:161


cooldownLimit?

optional cooldownLimit: number

The amount of entries the cooldown can have before filling up, if set to a non-zero value alongside CommandOptions.cooldownDelay, the Cooldown precondition will be added to the list.

Since

2.0.0

Default

1

Defined in

projects/framework/src/lib/types/CommandTypes.ts:139


cooldownScope?

optional cooldownScope: BucketScope

The scope of the cooldown entries.

Since

2.0.0

Default

BucketScope.User

Defined in

projects/framework/src/lib/types/CommandTypes.ts:153


description?

optional description: string

The description for the command.

Since

1.0.0

Default

''

Defined in

projects/framework/src/lib/types/CommandTypes.ts:82


detailedDescription?

optional detailedDescription: DetailedDescriptionCommand

The detailed description for the command.

Since

1.0.0

Default

''

Defined in

projects/framework/src/lib/types/CommandTypes.ts:89


flags?

optional flags: boolean | readonly string[]

The accepted flags. Flags are key-only identifiers that can be placed anywhere in the command. Two different types are accepted:

  • An array of strings, e.g. [silent].
  • A boolean defining whether the strategy should accept all keys (true) or none at all (false).

Default

[]

Inherited from

FlagStrategyOptions.flags

Defined in

projects/framework/src/lib/utils/strategies/FlagUnorderedStrategy.ts:14


fullCategory?

optional fullCategory: string[]

The full category path for the command

Since

2.0.0

Default

'An array of folder names that lead back to the folder that is registered for in the commands store'

Example

// Given a file named `ping.js` at the path of `commands/General/ping.js`
['General']

// Given a file named `info.js` at the path of `commands/General/About/info.js`
['General', 'About']

Defined in

projects/framework/src/lib/types/CommandTypes.ts:104


generateDashLessAliases?

optional generateDashLessAliases: boolean

Whether to add aliases for commands with dashes in them

Since

1.0.0

Default

false

Defined in

projects/framework/src/lib/types/CommandTypes.ts:68


generateUnderscoreLessAliases?

optional generateUnderscoreLessAliases: boolean

Whether to add aliases for commands with underscores in them

Since

3.0.0

Default

false

Defined in

projects/framework/src/lib/types/CommandTypes.ts:75


nsfw?

optional nsfw: boolean

Sets whether the command should be treated as NSFW. If set to true, the NSFW precondition will be added to the list.

Since

2.0.0

Default

false

Defined in

projects/framework/src/lib/types/CommandTypes.ts:132


options?

optional options: boolean | readonly string[]

The accepted options. Options are key-value identifiers that can be placed anywhere in the command. Two different types are accepted:

  • An array of strings, e.g. [silent].
  • A boolean defining whether the strategy should accept all keys (true) or none at all (false).

Default

[]

Inherited from

FlagStrategyOptions.options

Defined in

projects/framework/src/lib/utils/strategies/FlagUnorderedStrategy.ts:22


preconditions?

optional preconditions: readonly PreconditionEntryResolvable[]

The Preconditions to be run, accepts an array of their names.

Seealso

PreconditionContainerArray

Since

1.0.0

Default

[]

Defined in

projects/framework/src/lib/types/CommandTypes.ts:112


prefixes?

optional prefixes: string[]

The prefixes for both flags and options.

Default

['--', '-', '—']

Inherited from

FlagStrategyOptions.prefixes

Defined in

projects/framework/src/lib/utils/strategies/FlagUnorderedStrategy.ts:28


quotes?

optional quotes: [string, string][]

The quotes accepted by this command, pass [] to disable them.

Since

1.0.0

Default

[
['"', '"'], // Double quotes
['“', '”'], // Fancy quotes (on iOS)
['「', '」'] // Corner brackets (CJK)
['«', '»'] // French quotes (guillemets)
]

Defined in

projects/framework/src/lib/types/CommandTypes.ts:125


requiredClientPermissions?

optional requiredClientPermissions: PermissionResolvable

The required permissions for the client.

Since

2.0.0

Default

0

Defined in

projects/framework/src/lib/types/CommandTypes.ts:168


requiredUserPermissions?

optional requiredUserPermissions: PermissionResolvable

The required permissions for the user.

Since

2.0.0

Default

0

Defined in

projects/framework/src/lib/types/CommandTypes.ts:175


runIn?

optional runIn: CommandRunInUnion | CommandSpecificRunIn

The channels the command should run in. If set to null, no precondition entry will be added. Some optimizations are applied when given an array to reduce the amount of preconditions run (e.g. 'GUILD_TEXT' and 'GUILD_NEWS' becomes 'GUILD_ANY', and if both 'DM' and 'GUILD_ANY' are defined, then no precondition entry is added as it runs in all channels).

This can be both CommandRunInUnion which will have the same precondition apply to all the types of commands, or you can use CommandSpecificRunIn to apply different preconditions to different types of commands.

Since

2.0.0

Default

null

Defined in

projects/framework/src/lib/types/CommandTypes.ts:188


separators?

optional separators: string[]

The flag separators.

Default

['=', ':']

Inherited from

FlagStrategyOptions.separators

Defined in

projects/framework/src/lib/utils/strategies/FlagUnorderedStrategy.ts:34


typing?

optional typing: boolean

If SapphireClient.typing is true, this option will override it. Otherwise, this option has no effect - you may call Channel#sendTyping` in the run method if you want specific commands to display the typing status.

Default

true

Defined in

projects/framework/src/lib/types/CommandTypes.ts:195