Skip to main content

Class: Precondition<Options>

Defined in: projects/framework/src/lib/structures/Precondition.ts:21

Extends

  • Piece<Options, "preconditions">

Extended by

Type Parameters

Type ParameterDefault type
Options extends OptionsOptions

Constructors

new Precondition()

new Precondition<Options>(context: LoaderContext, options: Options): Precondition<Options>

Defined in: projects/framework/src/lib/structures/Precondition.ts:24

Parameters

ParameterType
contextLoaderContext
optionsOptions

Returns

Precondition<Options>

Overrides

Piece<Options, 'preconditions'>.constructor

Properties

position

readonly position: null | number

Defined in: projects/framework/src/lib/structures/Precondition.ts:22

Methods

chatInputRun()?

optional chatInputRun(interaction: ChatInputCommandInteraction, command: ChatInputCommand, context: PreconditionContext): PreconditionResult

Defined in: projects/framework/src/lib/structures/Precondition.ts:31

Parameters

ParameterType
interactionChatInputCommandInteraction
commandChatInputCommand
contextPreconditionContext

Returns

PreconditionResult


contextMenuRun()?

optional contextMenuRun(interaction: ContextMenuCommandInteraction, command: ContextMenuCommand, context: PreconditionContext): PreconditionResult

Defined in: projects/framework/src/lib/structures/Precondition.ts:33

Parameters

ParameterType
interactionContextMenuCommandInteraction
commandContextMenuCommand
contextPreconditionContext

Returns

PreconditionResult


error()

error(options: Omit<Options, "precondition">): PreconditionResult

Defined in: projects/framework/src/lib/structures/Precondition.ts:47

Constructs a PreconditionError with the precondition parameter set to this.

Parameters

ParameterTypeDescription
optionsOmit<Options, "precondition">The information.

Returns

PreconditionResult


fetchChannelFromInteraction()

protected fetchChannelFromInteraction(interaction: CommandInteraction): Promise<TextBasedChannel>

Defined in: projects/framework/src/lib/structures/Precondition.ts:51

Parameters

ParameterType
interactionCommandInteraction

Returns

Promise<TextBasedChannel>


messageRun()?

optional messageRun(message: Message, command: MessageCommand, context: PreconditionContext): PreconditionResult

Defined in: projects/framework/src/lib/structures/Precondition.ts:29

Parameters

ParameterType
messageMessage
commandMessageCommand
contextPreconditionContext

Returns

PreconditionResult


ok()

ok(): PreconditionResult

Defined in: projects/framework/src/lib/structures/Precondition.ts:39

Returns

PreconditionResult