Skip to main content

callCustomizer

Documentation


Documentation / @discordeno/bot / callCustomizer

Function: callCustomizer()

callCustomizer<TInfo>(customizer, bot, payload, transformed, extra): any

Defined in: transformers.ts:690

Calls a transformer customizer function with the provided parameters.

Type Parameters​

TInfo​

TInfo extends keyof TransformerInformations

The key of the transformer information to use.

Parameters​

customizer​

TInfo

The key of the transformer information to use.

bot​

Bot

The bot instance.

payload​

TransformerInformations[TInfo]["payload"] | Partial<TransformerInformations[TInfo]["payload"]>

The original payload from Discord.

transformed​

SetupDesiredProps<TransformerInformations[TInfo]["transformed"], TransformersDesiredProperties, DesiredPropertiesBehavior> | Partial<SetupDesiredProps<TransformerInformations[TInfo]["transformed"], TransformersDesiredProperties, DesiredPropertiesBehavior>>

The transformed object.

extra​

TransformerInformations[TInfo]["extra"] & object

Additional extra information for the customizer.

Returns​

any

The result of the customizer function.

Remarks​

This function is used because it is hard to deal with the customizer overloads directly in the transformers.

Since the overloads are present only with partial transformers, this function requires the partial extra, for non-partial transformers the normal function call can be used