Skip to main content

Class: Precondition<Options>

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>

Parameters

ParameterType
contextLoaderContext
optionsOptions

Returns

Precondition<Options>

Overrides

Piece<Options, 'preconditions'>.constructor

Defined in

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

Properties

position

readonly position: null | number

Defined in

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

Methods

chatInputRun()?

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

Parameters

ParameterType
interactionChatInputCommandInteraction<CacheType>
commandChatInputCommand
contextPreconditionContext

Returns

PreconditionResult

Defined in

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


contextMenuRun()?

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

Parameters

ParameterType
interactionContextMenuCommandInteraction<CacheType>
commandContextMenuCommand
contextPreconditionContext

Returns

PreconditionResult

Defined in

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


error()

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

Constructs a PreconditionError with the precondition parameter set to this.

Parameters

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

Returns

PreconditionResult

Defined in

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


fetchChannelFromInteraction()

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

Parameters

ParameterType
interactionCommandInteraction<CacheType>

Returns

Promise<TextBasedChannel>

Defined in

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


messageRun()?

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

Parameters

ParameterType
messageMessage<boolean>
commandMessageCommand
contextPreconditionContext

Returns

PreconditionResult

Defined in

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


ok()

ok(): PreconditionResult

Returns

PreconditionResult

Defined in

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