Skip to main content

Class: PluginSubcommandCooldownPrecondition

Defined in: projects/plugins/packages/subcommands/src/preconditions/PluginSubcommandCooldown.ts:30

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​

Constructor​

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

Defined in: node_modules/@sapphire/framework/dist/esm/index.d.mts:525

Parameters​

ParameterType
contextLoaderContext
options?PreconditionOptions

Returns​

PluginPrecondition

Inherited from​

AllFlowsPrecondition.constructor

Properties​

enabled​

enabled: boolean

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

Whether or not the piece is enabled.

Inherited from​

AllFlowsPrecondition.enabled


location​

readonly location: PieceLocation

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

The location metadata for the piece's file.

Inherited from​

AllFlowsPrecondition.location


name​

readonly name: string

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

The name of the piece.

Inherited from​

AllFlowsPrecondition.name


options​

readonly options: PreconditionOptions

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

The raw options passed to this Piece

Inherited from​

AllFlowsPrecondition.options


position​

readonly position: null | number

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

Inherited from​

AllFlowsPrecondition.position


store​

readonly store: PreconditionStore

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

The store that contains the piece.

Inherited from​

AllFlowsPrecondition.store


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

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

A reference to the Container object for ease of use.

See​

container

Returns​

Container

Inherited from​

AllFlowsPrecondition.container

Methods​

chatInputRun()​

chatInputRun(interaction: ChatInputCommandInteraction, subcommand: Subcommand, context: PluginSubcommandCooldownPreconditionContext): PreconditionResult

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

Parameters​

ParameterType
interactionChatInputCommandInteraction
subcommandSubcommand
contextPluginSubcommandCooldownPreconditionContext

Returns​

PreconditionResult

Overrides​

AllFlowsPrecondition.chatInputRun


contextMenuRun()​

contextMenuRun(interaction: ContextMenuCommandInteraction, subcommand: Command, context: PluginSubcommandCooldownPreconditionContext): PreconditionResult

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

Parameters​

ParameterType
interactionContextMenuCommandInteraction
subcommandCommand
contextPluginSubcommandCooldownPreconditionContext

Returns​

PreconditionResult

Overrides​

AllFlowsPrecondition.contextMenuRun


error()​

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

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

Constructs a PreconditionError with the precondition parameter set to this.

Parameters​

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

Returns​

PreconditionResult

Inherited from​

AllFlowsPrecondition.error


fetchChannelFromInteraction()​

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

Defined in: node_modules/@sapphire/framework/dist/esm/index.d.mts:535

Parameters​

ParameterType
interactionCommandInteraction

Returns​

Promise<TextBasedChannel>

Inherited from​

AllFlowsPrecondition.fetchChannelFromInteraction


getIdFromInteraction()​

private getIdFromInteraction(interaction: CommandInteraction, context: PluginSubcommandCooldownPreconditionContext): string

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

Parameters​

ParameterType
interactionCommandInteraction
contextPluginSubcommandCooldownPreconditionContext

Returns​

string


getIdFromMessage()​

private getIdFromMessage(message: Message, context: PluginSubcommandCooldownPreconditionContext): string

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

Parameters​

ParameterType
messageMessage
contextPluginSubcommandCooldownPreconditionContext

Returns​

string


getManager()​

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

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

Parameters​

ParameterType
subcommandSubcommand
contextPluginSubcommandCooldownPreconditionContext

Returns​

RateLimitManager<string>


getSubcommandMappingName()​

private getSubcommandMappingName(context: PluginSubcommandCooldownPreconditionContext): string

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

Parameters​

ParameterType
contextPluginSubcommandCooldownPreconditionContext

Returns​

string


messageRun()​

messageRun(message: Message, subcommand: Subcommand, context: PluginSubcommandCooldownPreconditionContext): PreconditionResult

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

Parameters​

ParameterType
messageMessage
subcommandSubcommand
contextPluginSubcommandCooldownPreconditionContext

Returns​

PreconditionResult

Overrides​

AllFlowsPrecondition.messageRun


ok()​

ok(): PreconditionResult

Defined in: node_modules/@sapphire/framework/dist/esm/index.d.mts:529

Returns​

PreconditionResult

Inherited from​

AllFlowsPrecondition.ok


onLoad()​

onLoad(): unknown

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

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


onUnload()​

onUnload(): unknown

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

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


reload()​

reload(): Promise<void>

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

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

Returns​

Promise<void>

Inherited from​

AllFlowsPrecondition.reload


sharedRun()​

private sharedRun(authorId: string, subcommand: Subcommand, context: PluginSubcommandCooldownPreconditionContext, cooldownId: string, commandType: string): PreconditionResult

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

Parameters​

ParameterType
authorIdstring
subcommandSubcommand
contextPluginSubcommandCooldownPreconditionContext
cooldownIdstring
commandTypestring

Returns​

PreconditionResult


toJSON()​

toJSON(): PieceJSON

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

Defines the JSON.stringify behavior of this piece.

Returns​

PieceJSON

Inherited from​

AllFlowsPrecondition.toJSON


unload()​

unload(): Promise<void>

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

Unloads and disables the piece.

Returns​

Promise<void>

Inherited from​

AllFlowsPrecondition.unload