Skip to main content

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

ParameterType
dataPreconditionSingleResolvable

Returns

PreconditionContainerSingle

Source

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

Source

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


name

readonly name: string

The name of the precondition to run.

Since

1.0.0

Source

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

Methods

chatInputRun()

chatInputRun(interaction: ChatInputCommandInteraction <CacheType>, command: ChatInputCommand, context: PreconditionContext): PreconditionResult

Runs the container.

Parameters

ParameterTypeDescription
interactionChatInputCommandInteraction <CacheType>The interaction that ran this precondition.
commandChatInputCommandThe command the interaction invoked.
contextPreconditionContextThe context for the chat input command precondition.

Returns

PreconditionResult

Implementation of

IPreconditionContainer . chatInputRun

Since

3.0.0

Source

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


contextMenuRun()

contextMenuRun(interaction: ContextMenuCommandInteraction <CacheType>, command: ContextMenuCommand, context: PreconditionContext): PreconditionResult

Runs the container.

Parameters

ParameterTypeDescription
interactionContextMenuCommandInteraction <CacheType>The interaction that ran this precondition.
commandContextMenuCommandThe command the interaction invoked.
contextPreconditionContextThe context for the context menu command precondition.

Returns

PreconditionResult

Implementation of

IPreconditionContainer . contextMenuRun

Since

3.0.0

Source

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


messageRun()

messageRun(message: Message<boolean>, command: MessageCommand, context: PreconditionContext): PreconditionResult

Runs the container.

Parameters

ParameterTypeDescription
messageMessage<boolean>The message that ran this precondition.
commandMessageCommandThe command the message invoked.
contextPreconditionContextThe context for the message precondition.

Returns

PreconditionResult

Implementation of

IPreconditionContainer . messageRun

Since

1.0.0

Source

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