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
| Parameter | Type |
|---|---|
context | LoaderContext |
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
readonlylocation: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
readonlyname:string
Defined in: node_modules/@sapphire/pieces/dist/esm/index.d.mts:230
The name of the piece.
Inherited from
AllFlowsPrecondition.name
options
readonlyoptions: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
readonlyposition:null|number
Defined in: node_modules/@sapphire/framework/dist/esm/index.d.mts:524
Inherited from
AllFlowsPrecondition.position
store
readonlystore: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
| Parameter | Type |
|---|---|
interaction | ChatInputCommandInteraction |
subcommand | Subcommand |
context | PluginSubcommandCooldownPreconditionContext |
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
| Parameter | Type |
|---|---|
interaction | ContextMenuCommandInteraction |
subcommand | Command |
context | PluginSubcommandCooldownPreconditionContext |
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
| Parameter | Type | Description |
|---|---|---|
options? | Omit<Options, "precondition"> | The information. |
Returns
PreconditionResult
Inherited from
AllFlowsPrecondition.error
fetchChannelFromInteraction()
protectedfetchChannelFromInteraction(interaction:CommandInteraction):Promise<TextBasedChannel>
Defined in: node_modules/@sapphire/framework/dist/esm/index.d.mts:535
Parameters
| Parameter | Type |
|---|---|
interaction | CommandInteraction |
Returns
Inherited from
AllFlowsPrecondition.fetchChannelFromInteraction
getIdFromInteraction()
privategetIdFromInteraction(interaction:CommandInteraction,context:PluginSubcommandCooldownPreconditionContext):string
Defined in: projects/plugins/packages/subcommands/src/preconditions/PluginSubcommandCooldown.ts:110
Parameters
| Parameter | Type |
|---|---|
interaction | CommandInteraction |
context | PluginSubcommandCooldownPreconditionContext |
Returns
string
getIdFromMessage()
privategetIdFromMessage(message:Message,context:PluginSubcommandCooldownPreconditionContext):string
Defined in: projects/plugins/packages/subcommands/src/preconditions/PluginSubcommandCooldown.ts:96
Parameters
| Parameter | Type |
|---|---|
message | Message |
context | PluginSubcommandCooldownPreconditionContext |
Returns
string
getManager()
privategetManager(subcommand:Subcommand,context:PluginSubcommandCooldownPreconditionContext):RateLimitManager<string>
Defined in: projects/plugins/packages/subcommands/src/preconditions/PluginSubcommandCooldown.ts:128
Parameters
| Parameter | Type |
|---|---|
subcommand | Subcommand |
context | PluginSubcommandCooldownPreconditionContext |
Returns
RateLimitManager<string>
getSubcommandMappingName()
privategetSubcommandMappingName(context:PluginSubcommandCooldownPreconditionContext):string
Defined in: projects/plugins/packages/subcommands/src/preconditions/PluginSubcommandCooldown.ts:124
Parameters
| Parameter | Type |
|---|---|
context | PluginSubcommandCooldownPreconditionContext |
Returns
string
messageRun()
messageRun(
message:Message,subcommand:Subcommand,context:PluginSubcommandCooldownPreconditionContext):PreconditionResult
Defined in: projects/plugins/packages/subcommands/src/preconditions/PluginSubcommandCooldown.ts:33
Parameters
| Parameter | Type |
|---|---|
message | Message |
subcommand | Subcommand |
context | PluginSubcommandCooldownPreconditionContext |
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()
privatesharedRun(authorId:string,subcommand:Subcommand,context:PluginSubcommandCooldownPreconditionContext,cooldownId:string,commandType:string):PreconditionResult
Defined in: projects/plugins/packages/subcommands/src/preconditions/PluginSubcommandCooldown.ts:63
Parameters
| Parameter | Type |
|---|---|
authorId | string |
subcommand | Subcommand |
context | PluginSubcommandCooldownPreconditionContext |
cooldownId | string |
commandType | string |
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