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:525

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:524


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 Signature

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:534


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:535


getIdFromInteraction()

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

Parameters

ParameterType
interactionCommandInteraction<CacheType>
contextPluginSubcommandCooldownPreconditionContext

Returns

string

Defined in

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

Defined in

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>

Defined in

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


getSubcommandMappingName()

private getSubcommandMappingName(context: PluginSubcommandCooldownPreconditionContext): string

Parameters

ParameterType
contextPluginSubcommandCooldownPreconditionContext

Returns

string

Defined in

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

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:529


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


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

Defined in

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

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