Class: Precondition<O>
The piece to be stored in Store instances.
Type parameters
Name | Type |
---|---|
O | extends Options = Options |
Hierarchy
Piece
<O
>↳
Precondition
Constructors
constructor
• new Precondition<O
>(context
, options?
)
Type parameters
Name | Type |
---|---|
O | extends PreconditionOptions = PreconditionOptions |
Parameters
Name | Type |
---|---|
context | PieceContext |
options | PreconditionOptions |
Overrides
Defined in
projects/framework/src/lib/structures/Precondition.ts:30
Properties
enabled
• enabled: boolean
Whether or not the piece is enabled.
Inherited from
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:450
location
• Readonly
location: PieceLocation
The location metadata for the piece's file.
Inherited from
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:442
name
• Readonly
name: string
The name of the piece.
Inherited from
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:446
options
• Readonly
options: O
The raw options passed to this Piece
Inherited from
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:454
position
• Readonly
position: null
| number
Defined in
projects/framework/src/lib/structures/Precondition.ts:28
store
• store: PreconditionStore
The PreconditionStore that contains this Precondition.
Overrides
Defined in
projects/framework/src/lib/structures/Precondition.ts:26
Accessors
container
• get
container(): Container
A reference to the Container object for ease of use.
Returns
Container
See
container
Inherited from
Piece.container
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:460
Methods
chatInputRun
▸ Optional
chatInputRun(interaction
, command
, context
): PreconditionResult
Parameters
Name | Type |
---|---|
interaction | ChatInputCommandInteraction <CacheType > |
command | ChatInputCommand |
context | PreconditionContext |
Returns
Defined in
projects/framework/src/lib/structures/Precondition.ts:37
contextMenuRun
▸ Optional
contextMenuRun(interaction
, command
, context
): PreconditionResult
Parameters
Name | Type |
---|---|
interaction | ContextMenuCommandInteraction <CacheType > |
command | ContextMenuCommand |
context | PreconditionContext |
Returns
Defined in
projects/framework/src/lib/structures/Precondition.ts:39
error
▸ error(options?
): PreconditionResult
Constructs a PreconditionError with the precondition parameter set to this
.
Parameters
Name | Type | Description |
---|---|---|
options | Omit <Options , "precondition" > | The information. |
Returns
Defined in
projects/framework/src/lib/structures/Precondition.ts:53
fetchChannelFromInteraction
▸ Protected
fetchChannelFromInteraction(interaction
): Promise
<TextBasedChannel
>
Parameters
Name | Type |
---|---|
interaction | CommandInteraction <CacheType > |
Returns
Promise
<TextBasedChannel
>
Defined in
projects/framework/src/lib/structures/Precondition.ts:57
messageRun
▸ Optional
messageRun(message
, command
, context
): PreconditionResult
Parameters
Name | Type |
---|---|
message | Message <boolean > |
command | MessageCommand |
context | PreconditionContext |
Returns
Defined in
projects/framework/src/lib/structures/Precondition.ts:35
ok
▸ ok(): PreconditionResult
Returns
Defined in
projects/framework/src/lib/structures/Precondition.ts:45
onLoad
▸ onLoad(): unknown
Per-piece listener that is called when the piece is loaded into the store. Useful to set-up asynchronous initialization tasks.
Returns
unknown
Inherited from
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:465
onUnload
▸ onUnload(): unknown
Per-piece listener that is called when the piece is unloaded from the store. Useful to set-up clean-up tasks.
Returns
unknown
Inherited from
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:470
reload
▸ reload(): Promise
<void
>
Reloads the piece by loading the same path in the store.
Returns
Promise
<void
>
Inherited from
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:478
toJSON
▸ toJSON(): PieceJSON
Defines the JSON.stringify
behavior of this piece.
Returns
PieceJSON
Inherited from
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:482
unload
▸ unload(): Promise
<void
>
Unloads and disables the piece.
Returns
Promise
<void
>
Inherited from
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:474