TelegramBotMiddleware

constructor(onRequestException: suspend (request: Request<*>, t: Throwable?) -> Any?? = null, onBeforeSearchCallFactory: suspend (request: Request<*>, callsFactories: List<KtorCallFactory>) -> Unit? = null, onBeforeCallFactoryMakeCall: suspend (request: Request<*>, potentialFactory: KtorCallFactory) -> Unit? = null, onAfterCallFactoryMakeCall: suspend (result: Any?, request: Request<*>, potentialFactory: KtorCallFactory) -> Any?? = null, onRequestResultPresented: suspend (result: Any?, request: Request<*>, resultCallFactory: KtorCallFactory, callsFactories: List<KtorCallFactory>) -> Any?? = null, onRequestResultAbsent: suspend (request: Request<*>, callsFactories: List<KtorCallFactory>) -> Any?? = null, onRequestReturnResult: suspend (result: Result<*>, request: Request<*>, callsFactories: List<KtorCallFactory>) -> Result<Any?>?? = null)

Parameters

onRequestException

Will be called when some exception happen during Request handling. Non-null result of lambda will be used as the result of request handling

onBeforeSearchCallFactory

Will be called when telegram bot starts to choose which KtorCallFactory will handle Request

onBeforeCallFactoryMakeCall

Will be called when telegram bot trying to use KtorCallFactory as potential handler for Request

onAfterCallFactoryMakeCall

Will be called when KtorCallFactory made call. Non-null result of lambda will be used as the result of request handling

onRequestResultPresented

Will be called when KtorCallFactory or TelegramBotPipelinesHandler/TelegramBotMiddleware returned non-null result. Non-null result of lambda will be used as the result of request handling

onRequestResultAbsent

Will be called when some there is no any result of Request handling. Non-null result of lambda will be used as the result of request handling

onRequestReturnResult

Latest lambda before result returning. Will be called after all previous stages. Non-null result of lambda will be used as the result of request handling