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
Parameter | Type |
---|---|
context | LoaderContext |
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
Parameter | Type |
---|---|
interaction | ChatInputCommandInteraction <CacheType > |
subcommand | Subcommand <Args , SubcommandOptions > |
context | PluginSubcommandCooldownPreconditionContext |
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
Parameter | Type |
---|---|
interaction | ContextMenuCommandInteraction <CacheType > |
subcommand | Command <Args , CommandOptions > |
context | PluginSubcommandCooldownPreconditionContext |
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
Parameter | Type | Description |
---|---|---|
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
Parameter | Type |
---|---|
interaction | CommandInteraction <CacheType > |
Returns
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
Parameter | Type |
---|---|
interaction | CommandInteraction <CacheType > |
context | PluginSubcommandCooldownPreconditionContext |
Returns
string
Defined in
projects/plugins/packages/subcommands/src/preconditions/PluginSubcommandCooldown.ts:110
getIdFromMessage()
private
getIdFromMessage(message
:Message
<boolean
>,context
:PluginSubcommandCooldownPreconditionContext
):string
Parameters
Parameter | Type |
---|---|
message | Message <boolean > |
context | PluginSubcommandCooldownPreconditionContext |
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
Parameter | Type |
---|---|
subcommand | Subcommand <Args , SubcommandOptions > |
context | PluginSubcommandCooldownPreconditionContext |
Returns
RateLimitManager
<string
>
Defined in
projects/plugins/packages/subcommands/src/preconditions/PluginSubcommandCooldown.ts:128
getSubcommandMappingName()
private
getSubcommandMappingName(context
:PluginSubcommandCooldownPreconditionContext
):string
Parameters
Parameter | Type |
---|---|
context | PluginSubcommandCooldownPreconditionContext |
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
Parameter | Type |
---|---|
message | Message <boolean > |
subcommand | Subcommand <Args , SubcommandOptions > |
context | PluginSubcommandCooldownPreconditionContext |
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
Parameter | Type |
---|---|
authorId | string |
subcommand | Subcommand <Args , SubcommandOptions > |
context | PluginSubcommandCooldownPreconditionContext |
cooldownId | string |
commandType | string |
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