Class: PreconditionContainerSingle
An IPreconditionContainer which runs a single precondition from SapphireClient.preconditions.
Since
1.0.0
Implements
Constructors
new PreconditionContainerSingle()
new PreconditionContainerSingle(
data
:PreconditionSingleResolvable
):PreconditionContainerSingle
Parameters
Parameter | Type |
---|---|
data | PreconditionSingleResolvable |
Returns
Defined in
projects/framework/src/lib/utils/preconditions/PreconditionContainerSingle.ts:67
Properties
context
readonly
context:Record
<PropertyKey
,unknown
>
The context to be used when calling Precondition.run. This will always be an empty object ({}
) when the
container was constructed with a string, otherwise it is a direct reference to the value from
PreconditionSingleResolvableDetails.context.
Since
1.0.0
Defined in
projects/framework/src/lib/utils/preconditions/PreconditionContainerSingle.ts:59
name
readonly
name:string
The name of the precondition to run.
Since
1.0.0
Defined in
projects/framework/src/lib/utils/preconditions/PreconditionContainerSingle.ts:65
Methods
chatInputRun()
chatInputRun(
interaction
:ChatInputCommandInteraction
<CacheType
>,command
:ChatInputCommand
,context
:PreconditionContext
):PreconditionResult
|Err
<UserError
,any
>
Runs the container.
Parameters
Parameter | Type | Description |
---|---|---|
interaction | ChatInputCommandInteraction <CacheType > | The interaction that ran this precondition. |
command | ChatInputCommand | The command the interaction invoked. |
context | PreconditionContext | The context for the chat input command precondition. |
Returns
PreconditionResult
| Err
<UserError
, any
>
Since
3.0.0
Implementation of
IPreconditionContainer
.chatInputRun
Defined in
projects/framework/src/lib/utils/preconditions/PreconditionContainerSingle.ts:104
contextMenuRun()
contextMenuRun(
interaction
:ContextMenuCommandInteraction
<CacheType
>,command
:ContextMenuCommand
,context
:PreconditionContext
):PreconditionResult
|Err
<UserError
,any
>
Runs the container.
Parameters
Parameter | Type | Description |
---|---|---|
interaction | ContextMenuCommandInteraction <CacheType > | The interaction that ran this precondition. |
command | ContextMenuCommand | The command the interaction invoked. |
context | PreconditionContext | The context for the context menu command precondition. |
Returns
PreconditionResult
| Err
<UserError
, any
>
Since
3.0.0
Implementation of
IPreconditionContainer
.contextMenuRun
Defined in
projects/framework/src/lib/utils/preconditions/PreconditionContainerSingle.ts:124
messageRun()
messageRun(
message
:Message
<boolean
>,command
:MessageCommand
,context
:PreconditionContext
):PreconditionResult
|Err
<UserError
,any
>
Runs the container.
Parameters
Parameter | Type | Description |
---|---|---|
message | Message <boolean > | The message that ran this precondition. |
command | MessageCommand | The command the message invoked. |
context | PreconditionContext | The context for the message precondition. |
Returns
PreconditionResult
| Err
<UserError
, any
>
Since
1.0.0
Implementation of
IPreconditionContainer
.messageRun
Defined in
projects/framework/src/lib/utils/preconditions/PreconditionContainerSingle.ts:84