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

Source

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

Source

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

Source

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


name

readonly name: string

The name of the piece.

Inherited from

AllFlowsPrecondition.name

Source

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

Source

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


position

readonly position: null | number

Inherited from

AllFlowsPrecondition.position

Source

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


store

readonly store: PreconditionStore

The store that contains the piece.

Inherited from

AllFlowsPrecondition.store

Source

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


subcommandBuckets

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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


getIdFromInteraction()

private getIdFromInteraction(interaction: CommandInteraction <CacheType>, context: PluginSubcommandCooldownPreconditionContext): string

Parameters

ParameterType
interactionCommandInteraction <CacheType>
contextPluginSubcommandCooldownPreconditionContext

Returns

string

Source

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


getIdFromMessage()

private getIdFromMessage(message: Message<boolean>, context: PluginSubcommandCooldownPreconditionContext): string

Parameters

ParameterType
messageMessage<boolean>
contextPluginSubcommandCooldownPreconditionContext

Returns

string

Source

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


getManager()

private getManager(subcommand: Subcommand<Args, SubcommandOptions>, context: PluginSubcommandCooldownPreconditionContext): RateLimitManager<string>

Parameters

ParameterType
subcommandSubcommand<Args, SubcommandOptions>
contextPluginSubcommandCooldownPreconditionContext

Returns

RateLimitManager<string>

Source

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


getSubcommandMappingName()

private getSubcommandMappingName(context: PluginSubcommandCooldownPreconditionContext): string

Parameters

ParameterType
contextPluginSubcommandCooldownPreconditionContext

Returns

string

Source

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


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

Source

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


ok()

ok(): PreconditionResult

Returns

PreconditionResult

Inherited from

AllFlowsPrecondition.ok

Source

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

Source

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

Source

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

Source

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


sharedRun()

private sharedRun(authorId: string, subcommand: Subcommand<Args, SubcommandOptions>, context: PluginSubcommandCooldownPreconditionContext, cooldownId: string, commandType: string): PreconditionResult

Parameters

ParameterType
authorIdstring
subcommandSubcommand<Args, SubcommandOptions>
contextPluginSubcommandCooldownPreconditionContext
cooldownIdstring
commandTypestring

Returns

PreconditionResult

Source

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


toJSON()

toJSON(): PieceJSON

Defines the JSON.stringify behavior of this piece.

Returns

PieceJSON

Inherited from

AllFlowsPrecondition.toJSON

Source

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

Source

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