mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-08 09:23:47 +00:00
upgrade onRequestResultPresented in middlewares
This commit is contained in:
parent
dccd15a5e9
commit
e5bffa7c51
@ -6,6 +6,7 @@
|
||||
* Add default middleware `ExceptionsThrottlerTelegramBotMiddleware`
|
||||
* Make `TelegramBotMiddlewaresPipelinesHandler` to be default `TelegramBotPipelinesHandler`
|
||||
* Make `DefaultKtorRequestsExecutor` now uses `runCatching` instead of `runCatchingSafely`
|
||||
* `onRequestResultPresented` lambda now accepts non-nullable `result`
|
||||
|
||||
## 18.2.2
|
||||
|
||||
|
@ -28,7 +28,7 @@ open class TelegramBotMiddleware(
|
||||
internal val onBeforeSearchCallFactory: (suspend (request: Request<*>, callsFactories: List<KtorCallFactory>) -> Unit)? = null,
|
||||
internal val onBeforeCallFactoryMakeCall: (suspend (request: Request<*>, potentialFactory: KtorCallFactory) -> Unit)? = null,
|
||||
internal val onAfterCallFactoryMakeCall: (suspend (result: Any?, request: Request<*>, potentialFactory: KtorCallFactory) -> Any?)? = null,
|
||||
internal val onRequestResultPresented: (suspend (result: Any?, request: Request<*>, resultCallFactory: KtorCallFactory, callsFactories: List<KtorCallFactory>) -> Any?)? = null,
|
||||
internal val onRequestResultPresented: (suspend (result: Any, request: Request<*>, resultCallFactory: KtorCallFactory, callsFactories: List<KtorCallFactory>) -> Any?)? = null,
|
||||
internal val onRequestResultAbsent: (suspend (request: Request<*>, callsFactories: List<KtorCallFactory>) -> Any?)? = null,
|
||||
internal val onRequestReturnResult: (suspend (result: Result<*>, request: Request<*>, callsFactories: List<KtorCallFactory>) -> Result<Any?>?)? = null,
|
||||
val id: String = uuid4().toString()
|
||||
|
@ -12,7 +12,7 @@ class TelegramBotMiddlewareBuilder {
|
||||
var onBeforeSearchCallFactory: (suspend (request: Request<*>, callsFactories: List<KtorCallFactory>) -> Unit)? = null
|
||||
var onBeforeCallFactoryMakeCall: (suspend (request: Request<*>, potentialFactory: KtorCallFactory) -> Unit)? = null
|
||||
var onAfterCallFactoryMakeCall: (suspend (result: Any?, request: Request<*>, potentialFactory: KtorCallFactory) -> Any?)? = null
|
||||
var onRequestResultPresented: (suspend (result: Any?, request: Request<*>, resultCallFactory: KtorCallFactory, callsFactories: List<KtorCallFactory>) -> Any?)? = null
|
||||
var onRequestResultPresented: (suspend (result: Any, request: Request<*>, resultCallFactory: KtorCallFactory, callsFactories: List<KtorCallFactory>) -> Any?)? = null
|
||||
var onRequestResultAbsent: (suspend (request: Request<*>, callsFactories: List<KtorCallFactory>) -> Any?)? = null
|
||||
var onRequestReturnResult: (suspend (result: Result<*>, request: Request<*>, callsFactories: List<KtorCallFactory>) -> Result<Any?>?)? = null
|
||||
var id: String = uuid4().toString()
|
||||
@ -44,7 +44,7 @@ class TelegramBotMiddlewareBuilder {
|
||||
/**
|
||||
* Useful way to set [onRequestResultPresented]
|
||||
*/
|
||||
fun doOnRequestResultPresented(block: suspend (result: Any?, request: Request<*>, resultCallFactory: KtorCallFactory, callsFactories: List<KtorCallFactory>) -> Any?) {
|
||||
fun doOnRequestResultPresented(block: suspend (result: Any, request: Request<*>, resultCallFactory: KtorCallFactory, callsFactories: List<KtorCallFactory>) -> Any?) {
|
||||
onRequestResultPresented = block
|
||||
}
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user