Skip to main content

Class: PluginSubcommandCooldownPrecondition

The subcommand cooldown precondition. This differs from the cooldown precondition in framework by using a separate bucket as well as resolving the id differently to ensure it is specific to a subcommand.

Since

5.1.0

Extends

  • AllFlowsPrecondition

Constructors

new PluginSubcommandCooldownPrecondition()

new PluginSubcommandCooldownPrecondition(context: LoaderContext, options?: PreconditionOptions): PluginSubcommandCooldownPrecondition

Parameters

ParameterType
contextLoaderContext
options?PreconditionOptions

Returns

PluginSubcommandCooldownPrecondition

Inherited from

AllFlowsPrecondition.constructor

Defined in

node_modules/@sapphire/framework/dist/esm/index.d.mts:524

Properties

enabled

enabled: boolean

Whether or not the piece is enabled.

Inherited from

AllFlowsPrecondition.enabled

Defined in

node_modules/@sapphire/pieces/dist/esm/index.d.mts:234


location

readonly location: PieceLocation

The location metadata for the piece's file.

Inherited from

AllFlowsPrecondition.location

Defined in

node_modules/@sapphire/pieces/dist/esm/index.d.mts:226


name

readonly name: string

The name of the piece.

Inherited from

AllFlowsPrecondition.name

Defined in

node_modules/@sapphire/pieces/dist/esm/index.d.mts:230


options

readonly options: PreconditionOptions

The raw options passed to this Piece

Inherited from

AllFlowsPrecondition.options

Defined in

node_modules/@sapphire/pieces/dist/esm/index.d.mts:238


position

readonly position: null | number

Inherited from

AllFlowsPrecondition.position

Defined in

node_modules/@sapphire/framework/dist/esm/index.d.mts:523


store

readonly store: PreconditionStore

The store that contains the piece.

Inherited from

AllFlowsPrecondition.store

Defined in

node_modules/@sapphire/pieces/dist/esm/index.d.mts:222


subcommandBuckets

subcommandBuckets: WeakMap<Subcommand<Args, SubcommandOptions>, RateLimitManager<string>>

Defined in

projects/plugins/packages/subcommands/src/preconditions/PluginSubcommandCooldown.ts:31

Accessors

container

get container(): Container

A reference to the Container object for ease of use.

See

container

Returns

Container

Inherited from

AllFlowsPrecondition.container

Defined in

node_modules/@sapphire/pieces/dist/esm/index.d.mts:244

Methods

chatInputRun()

chatInputRun(interaction: ChatInputCommandInteraction<CacheType>, subcommand: Subcommand<Args, SubcommandOptions>, context: PluginSubcommandCooldownPreconditionContext): PreconditionResult

Parameters

ParameterType
interactionChatInputCommandInteraction<CacheType>
subcommandSubcommand<Args, SubcommandOptions>
contextPluginSubcommandCooldownPreconditionContext

Returns

PreconditionResult

Overrides

AllFlowsPrecondition.chatInputRun

Defined in

projects/plugins/packages/subcommands/src/preconditions/PluginSubcommandCooldown.ts:43


contextMenuRun()

contextMenuRun(interaction: ContextMenuCommandInteraction<CacheType>, subcommand: Command<Args, CommandOptions>, context: PluginSubcommandCooldownPreconditionContext): PreconditionResult

Parameters

ParameterType
interactionContextMenuCommandInteraction<CacheType>
subcommandCommand<Args, CommandOptions>
contextPluginSubcommandCooldownPreconditionContext

Returns

PreconditionResult

Overrides

AllFlowsPrecondition.contextMenuRun

Defined in

projects/plugins/packages/subcommands/src/preconditions/PluginSubcommandCooldown.ts:53


error()

error(options?: Omit<Options, "precondition">): PreconditionResult

Constructs a PreconditionError with the precondition parameter set to this.

Parameters

ParameterTypeDescription
options?Omit<Options, "precondition">The information.

Returns

PreconditionResult

Inherited from

AllFlowsPrecondition.error

Defined in

node_modules/@sapphire/framework/dist/esm/index.d.mts:533


fetchChannelFromInteraction()

protected fetchChannelFromInteraction(interaction: CommandInteraction<CacheType>): Promise<TextBasedChannel>

Parameters

ParameterType
interactionCommandInteraction<CacheType>

Returns

Promise<TextBasedChannel>

Inherited from

AllFlowsPrecondition.fetchChannelFromInteraction

Defined in

node_modules/@sapphire/framework/dist/esm/index.d.mts:534


messageRun()

messageRun(message: Message<boolean>, subcommand: Subcommand<Args, SubcommandOptions>, context: PluginSubcommandCooldownPreconditionContext): PreconditionResult

Parameters

ParameterType
messageMessage<boolean>
subcommandSubcommand<Args, SubcommandOptions>
contextPluginSubcommandCooldownPreconditionContext

Returns

PreconditionResult

Overrides

AllFlowsPrecondition.messageRun

Defined in

projects/plugins/packages/subcommands/src/preconditions/PluginSubcommandCooldown.ts:33


ok()

ok(): PreconditionResult

Returns

PreconditionResult

Inherited from

AllFlowsPrecondition.ok

Defined in

node_modules/@sapphire/framework/dist/esm/index.d.mts:528


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

AllFlowsPrecondition.onLoad

Defined in

node_modules/@sapphire/pieces/dist/esm/index.d.mts:249


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

AllFlowsPrecondition.onUnload

Defined in

node_modules/@sapphire/pieces/dist/esm/index.d.mts:254


reload()

reload(): Promise<void>

Reloads the piece by loading the same path in the store.

Returns

Promise<void>

Inherited from

AllFlowsPrecondition.reload

Defined in

node_modules/@sapphire/pieces/dist/esm/index.d.mts:262


toJSON()

toJSON(): PieceJSON

Defines the JSON.stringify behavior of this piece.

Returns

PieceJSON

Inherited from

AllFlowsPrecondition.toJSON

Defined in

node_modules/@sapphire/pieces/dist/esm/index.d.mts:266


unload()

unload(): Promise<void>

Unloads and disables the piece.

Returns

Promise<void>

Inherited from

AllFlowsPrecondition.unload

Defined in

node_modules/@sapphire/pieces/dist/esm/index.d.mts:258