Skip to main content

Class: PreconditionContainerSingle

An IPreconditionContainer which runs a single precondition from {@link SapphireClient.preconditions}.

since 1.0.0

Implements

Constructors

constructor

new PreconditionContainerSingle(data)

Parameters

NameType
dataPreconditionSingleResolvable

Defined in

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

Properties

context

Readonly context: Record<PropertyKey, unknown>

The context to be used when calling {@link 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:56


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:62

Methods

chatInputRun

chatInputRun(interaction, command, context?): PreconditionResult

Runs the container.

since 3.0.0

Parameters

NameTypeDescription
interactionCommandInteraction<CacheType>The interaction that ran this precondition.
commandChatInputCommandThe command the interaction invoked.
contextPreconditionContext-

Returns

PreconditionResult

Implementation of

IPreconditionContainer.chatInputRun

Defined in

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


contextMenuRun

contextMenuRun(interaction, command, context?): PreconditionResult

Runs the container.

since 3.0.0

Parameters

NameTypeDescription
interactionContextMenuInteraction<CacheType>The interaction that ran this precondition.
commandContextMenuCommandThe command the interaction invoked.
contextPreconditionContext-

Returns

PreconditionResult

Implementation of

IPreconditionContainer.contextMenuRun

Defined in

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


messageRun

messageRun(message, command, context?): PreconditionResult

Runs the container.

since 1.0.0

Parameters

NameTypeDescription
messageMessage<boolean>The message that ran this precondition.
commandMessageCommandThe command the message invoked.
contextPreconditionContext-

Returns

PreconditionResult

Implementation of

IPreconditionContainer.messageRun

Defined in

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