Skip to main content

Class: PreconditionContainerSingle

Defined in: projects/framework/src/lib/utils/preconditions/PreconditionContainerSingle.ts:52

An IPreconditionContainer which runs a single precondition from SapphireClient.preconditions.

Since​

1.0.0

Implements​

Constructors​

Constructor​

new PreconditionContainerSingle(data: PreconditionSingleResolvable): PreconditionContainerSingle

Defined in: projects/framework/src/lib/utils/preconditions/PreconditionContainerSingle.ts:67

Parameters​

ParameterType
dataPreconditionSingleResolvable

Returns​

PreconditionContainerSingle

Properties​

context​

readonly context: Record<PropertyKey, unknown>

Defined in: projects/framework/src/lib/utils/preconditions/PreconditionContainerSingle.ts:59

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


name​

readonly name: string

Defined in: projects/framework/src/lib/utils/preconditions/PreconditionContainerSingle.ts:65

The name of the precondition to run.

Since​

1.0.0

Methods​

chatInputRun()​

chatInputRun(interaction: ChatInputCommandInteraction, command: ChatInputCommand, context: PreconditionContext): PreconditionResult | Err<UserError, any>

Defined in: projects/framework/src/lib/utils/preconditions/PreconditionContainerSingle.ts:104

Runs the container.

Parameters​

ParameterTypeDescription
interactionChatInputCommandInteractionThe interaction that ran this precondition.
commandChatInputCommandThe command the interaction invoked.
contextPreconditionContextThe context for the chat input command precondition.

Returns​

PreconditionResult | Err<UserError, any>

Since​

3.0.0

Implementation of​

IPreconditionContainer.chatInputRun


contextMenuRun()​

contextMenuRun(interaction: ContextMenuCommandInteraction, command: ContextMenuCommand, context: PreconditionContext): PreconditionResult | Err<UserError, any>

Defined in: projects/framework/src/lib/utils/preconditions/PreconditionContainerSingle.ts:124

Runs the container.

Parameters​

ParameterTypeDescription
interactionContextMenuCommandInteractionThe interaction that ran this precondition.
commandContextMenuCommandThe command the interaction invoked.
contextPreconditionContextThe context for the context menu command precondition.

Returns​

PreconditionResult | Err<UserError, any>

Since​

3.0.0

Implementation of​

IPreconditionContainer.contextMenuRun


messageRun()​

messageRun(message: Message, command: MessageCommand, context: PreconditionContext): PreconditionResult | Err<UserError, any>

Defined in: projects/framework/src/lib/utils/preconditions/PreconditionContainerSingle.ts:84

Runs the container.

Parameters​

ParameterTypeDescription
messageMessageThe message that ran this precondition.
commandMessageCommandThe command the message invoked.
contextPreconditionContextThe context for the message precondition.

Returns​

PreconditionResult | Err<UserError, any>

Since​

1.0.0

Implementation of​

IPreconditionContainer.messageRun