Skip to main content

Class: PreconditionContainerSingle

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

Since

1.0.0

Implements

Constructors

constructor

new PreconditionContainerSingle(data): PreconditionContainerSingle

Parameters

NameType
dataPreconditionSingleResolvable

Returns

PreconditionContainerSingle

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, command, context?): PreconditionResult

Runs the container.

Parameters

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

Returns

PreconditionResult

Since

3.0.0

Implementation of

IPreconditionContainer.chatInputRun

Defined in

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


contextMenuRun

contextMenuRun(interaction, command, context?): PreconditionResult

Runs the container.

Parameters

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

Returns

PreconditionResult

Since

3.0.0

Implementation of

IPreconditionContainer.contextMenuRun

Defined in

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


messageRun

messageRun(message, command, context?): PreconditionResult

Runs the container.

Parameters

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

Returns

PreconditionResult

Since

1.0.0

Implementation of

IPreconditionContainer.messageRun

Defined in

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