diff --git a/CHANGELOG.md b/CHANGELOG.md index 9aa353a4eb..0518abb23f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # TelegramBotAPI changelog +## 14.1.0 + +* `Version`: + * `Coroutines`: `1.8.0` -> `1.8.1` + * `Ktor`: `2.3.10` -> `2.3.11` + * `MicroUtils`: `0.20.45` -> `0.21.0` + * `KSLog`: `1.3.3` -> `1.3.4` +* `BehaviourBuilder`: + * `BehaviourContext` updates listening job will be weakly subscribed. It means that `BehaviourContext` scope will + not be prevented from cancelling by this job anymore + * `BehaviourContext.doInContext` will not stop automatically current `BehaviourContext` job anymore + * `BehaviourContext.createSubContextAndDoWithUpdatesFilter` will use `supervisorScope` instead of + `LinkedSupervisorScope`. That will prevent scope leaking in runtime + ## 14.0.1 * In `core` and `api` modules related to invoices changed their APIs to suite current API diff --git a/gradle.properties b/gradle.properties index bf9769c9e5..5af7457d09 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,4 +6,4 @@ kotlin.incremental=true kotlin.incremental.js=true library_group=dev.inmo -library_version=14.0.1 +library_version=14.1.0 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7bcca67082..c7e4b00f61 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,19 +2,19 @@ kotlin = "1.9.23" kotlin-serialization = "1.6.3" -kotlin-coroutines = "1.8.0" +kotlin-coroutines = "1.8.1" javax-activation = "1.1.1" korlibs = "5.4.0" uuid = "0.8.4" -ktor = "2.3.10" +ktor = "2.3.11" ksp = "1.9.23-1.0.20" kotlin-poet = "1.16.0" -microutils = "0.20.45" -kslog = "1.3.3" +microutils = "0.21.0" +kslog = "1.3.4" versions = "0.51.0" diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt index 23c8fa19ee..261d23379b 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.extensions.api import dev.inmo.micro_utils.coroutines.LinkedSupervisorJob +import dev.inmo.micro_utils.coroutines.LinkedSupervisorScope import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions import dev.inmo.tgbotapi.abstracts.* import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup @@ -54,8 +55,9 @@ suspend fun TelegramBot.handleLiveLocation( val updateMessageJob = if (liveTimeMillis == indefiniteLivePeriodDelayMillis) { // do not launch refreshing of message for indefinite live locations null } else { - CoroutineScope(currentCoroutineContext().LinkedSupervisorJob()).launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) { - while (isActive) { + val scope = currentCoroutineContext().LinkedSupervisorScope() + scope.launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) { + while (scope.isActive) { delay(liveTimeMillis) // Remove previous location message info to resend live location message currentLiveLocationMessage = null diff --git a/tgbotapi.behaviour_builder/api/tgbotapi.behaviour_builder.api b/tgbotapi.behaviour_builder/api/tgbotapi.behaviour_builder.api index 17d4107dc5..7a5cf4894c 100644 --- a/tgbotapi.behaviour_builder/api/tgbotapi.behaviour_builder.api +++ b/tgbotapi.behaviour_builder/api/tgbotapi.behaviour_builder.api @@ -36,10 +36,9 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourConte public static final fun CustomBehaviourContextReceiver (Lkotlin/jvm/functions/Function2;)Lkotlin/jvm/functions/Function2; public static final fun createSubContext (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Lkotlinx/coroutines/CoroutineScope;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlinx/coroutines/flow/Flow;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext; public static synthetic fun createSubContext$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Lkotlinx/coroutines/CoroutineScope;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlinx/coroutines/flow/Flow;ILjava/lang/Object;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext; - public static final fun createSubContextAndDoWithUpdatesFilter (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Lkotlinx/coroutines/CoroutineScope;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlinx/coroutines/flow/Flow;ZLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun createSubContextAndDoWithUpdatesFilter$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Lkotlinx/coroutines/CoroutineScope;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlinx/coroutines/flow/Flow;ZLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static final fun doInContext (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;ZLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun doInContext$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;ZLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun createSubContextAndDoWithUpdatesFilter (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun createSubContextAndDoWithUpdatesFilter$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun doInContext (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun stop (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;)V } diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt index 56b3448981..1f96aef8cd 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt @@ -87,7 +87,7 @@ class DefaultBehaviourContext( } else { it } - }.accumulatorFlow(scope) + }.accumulatorFlow(WeakScope(scope)) override val asUpdateReceiver: UpdateReceiver = additionalUpdatesSharedFlow::emit override fun copy( @@ -133,38 +133,32 @@ fun BC.createSubContext( /** * Launch [behaviourContextReceiver] in context of [this] as [BehaviourContext] and as [kotlin.coroutines.CoroutineContext] * - * @param stopOnCompletion ___FALSE BY DEFAULT___. Will stop [this] in case if passed true + * [this] [BehaviourContext] will **NOT** be closed automatically */ suspend fun BC.doInContext( - stopOnCompletion: Boolean = false, behaviourContextReceiver: CustomBehaviourContextReceiver ): T { return withContext(coroutineContext) { - behaviourContextReceiver().also { if (stopOnCompletion) stop() } + behaviourContextReceiver() } } /** * Creates new one [BehaviourContext] using [createSubContext] and launches [behaviourContextReceiver] in a new context * using [doInContext] - * - * @param stopOnCompletion ___TRUE BY DEFAULT___ */ suspend fun BC.createSubContextAndDoWithUpdatesFilter( - scope: CoroutineScope = LinkedSupervisorScope(), triggersHolder: TriggersHolder = this.triggersHolder, updatesUpstreamFlow: Flow = allUpdatesFlow, - stopOnCompletion: Boolean = true, behaviourContextReceiver: CustomBehaviourContextReceiver ): T { - return createSubContext( - scope, - triggersHolder, - updatesUpstreamFlow - ).doInContext( - stopOnCompletion, - behaviourContextReceiver - ) + return supervisorScope { + createSubContext( + scope = this@supervisorScope, + triggersHolder = triggersHolder, + updatesUpstreamFlow = updatesUpstreamFlow + ).behaviourContextReceiver() + } } /** diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/Base.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/Base.kt index 0b0eb2c008..8ad99d900e 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/Base.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/Base.kt @@ -38,7 +38,9 @@ suspend fun FlowsUpdatesFilter.expectFlow( filter: suspend (Update) -> List ): Flow { val flow = allUpdatesFlow.map { - val result = safelyWithResult { filter(it) } + val result = runCatching { + filter(it) + } if (result.isFailure || result.getOrThrow().isEmpty()) { if (cancelTrigger(it)) { cancelRequestFactory(it) ?.also { @@ -47,14 +49,20 @@ suspend fun FlowsUpdatesFilter.expectFlow( } } errorFactory(it) ?.also { errorRequest -> - safelyWithoutExceptions { bot.execute(errorRequest) } + runCatching { + bot.execute(errorRequest) + } } emptyList() } else { result.getOrThrow() } }.flatten() - initRequest ?.also { safelyWithoutExceptions { bot.execute(initRequest) } } + initRequest ?.also { + runCatching { + bot.execute(initRequest) + } + } return flow } diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/BusinessConnectionTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/BusinessConnectionTriggers.kt index 68c0386e46..d98c162db4 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/BusinessConnectionTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/BusinessConnectionTriggers.kt @@ -19,15 +19,16 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onBusinessConnection( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByUserBusinessConnectionUpdatedMarkerFactory, + markerFactory: MarkerFactory? = ByUserBusinessConnectionUpdatedMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { (it.businessConnectionUpdateOrNull() ?.data) ?.let(::listOfNotNull) @@ -40,15 +41,16 @@ suspend fun BC.onBusinessConnection( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onBusinessConnectionEnabled( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByUserBusinessConnectionUpdatedMarkerFactory, + markerFactory: MarkerFactory? = ByUserBusinessConnectionUpdatedMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { (it.businessConnectionUpdateOrNull() ?.data ?.enabledOrNull()) ?.let(::listOfNotNull) @@ -60,15 +62,16 @@ suspend fun BC.onBusinessConnectionEnabled( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onBusinessConnectionDisabled( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByUserBusinessConnectionUpdatedMarkerFactory, + markerFactory: MarkerFactory? = ByUserBusinessConnectionUpdatedMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { (it.businessConnectionUpdateOrNull() ?.data ?.disabledOrNull()) ?.let(::listOfNotNull) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt index c2ca912858..07d81d044e 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt @@ -18,7 +18,7 @@ import kotlinx.coroutines.Job internal suspend inline fun BC.onCallbackQuery( initialFilter: SimpleFilter? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { (it.callbackQueryUpdateOrNull() ?.data as? T) ?.let(::listOfNotNull) @@ -31,15 +31,16 @@ internal suspend inline fun B * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ internal suspend inline fun BC.onDataCallbackQueryCounted( initialFilter: SimpleFilter? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver ): Job { val newInitialFilter = SimpleFilter { @@ -73,15 +74,16 @@ internal suspend inline fun BC.onDataCallbackQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onDataCallbackQueryCounted( initialFilter, @@ -99,8 +101,9 @@ suspend fun BC.onDataCallbackQuery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ @@ -108,7 +111,7 @@ suspend fun BC.onDataCallbackQuery( dataRegex: Regex, initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onDataCallbackQuery( initialFilter = initialFilter * { @@ -127,8 +130,9 @@ suspend fun BC.onDataCallbackQuery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ @@ -136,7 +140,7 @@ suspend fun BC.onDataCallbackQuery( data: String, initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onDataCallbackQuery( Regex(data), @@ -153,15 +157,16 @@ suspend fun BC.onDataCallbackQuery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onGameShortNameCallbackQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery( initialFilter, @@ -177,15 +182,16 @@ suspend fun BC.onGameShortNameCallbackQuery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onInlineMessageIdCallbackQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery( initialFilter, @@ -201,15 +207,16 @@ suspend fun BC.onInlineMessageIdCallbackQuery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onInlineMessageIdDataCallbackQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onDataCallbackQueryCounted( initialFilter, @@ -227,8 +234,9 @@ suspend fun BC.onInlineMessageIdDataCallbackQuery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ @@ -236,7 +244,7 @@ suspend fun BC.onInlineMessageIdDataCallbackQuery( dataRegex: Regex, initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onInlineMessageIdDataCallbackQuery( initialFilter = initialFilter * { @@ -255,8 +263,9 @@ suspend fun BC.onInlineMessageIdDataCallbackQuery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ @@ -264,7 +273,7 @@ suspend fun BC.onInlineMessageIdDataCallbackQuery( data: String, initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onInlineMessageIdDataCallbackQuery( Regex(data), @@ -281,15 +290,16 @@ suspend fun BC.onInlineMessageIdDataCallbackQuery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onInlineMessageIdGameShortNameCallbackQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery( initialFilter, @@ -305,15 +315,16 @@ suspend fun BC.onInlineMessageIdGameShortNameCallbackQue * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onMessageCallbackQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery( initialFilter, @@ -329,15 +340,16 @@ suspend fun BC.onMessageCallbackQuery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onMessageDataCallbackQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onDataCallbackQueryCounted( initialFilter, @@ -355,8 +367,9 @@ suspend fun BC.onMessageDataCallbackQuery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ @@ -364,7 +377,7 @@ suspend fun BC.onMessageDataCallbackQuery( dataRegex: Regex, initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onMessageDataCallbackQuery( initialFilter = initialFilter * { @@ -383,8 +396,9 @@ suspend fun BC.onMessageDataCallbackQuery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ @@ -392,7 +406,7 @@ suspend fun BC.onMessageDataCallbackQuery( data: String, initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onMessageDataCallbackQuery( Regex(data), @@ -409,15 +423,16 @@ suspend fun BC.onMessageDataCallbackQuery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onMessageGameShortNameCallbackQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery( initialFilter, @@ -433,15 +448,16 @@ suspend fun BC.onMessageGameShortNameCallbackQuery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onUnknownCallbackQueryType( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery( initialFilter, diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggersUnhandled.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggersUnhandled.kt index 22f4fd4bdb..01fa602bab 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggersUnhandled.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggersUnhandled.kt @@ -18,8 +18,9 @@ import dev.inmo.tgbotapi.utils.PreviewFeature * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ @@ -27,7 +28,7 @@ import dev.inmo.tgbotapi.utils.PreviewFeature suspend fun BC.onUnhandledDataCallbackQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery ( initialFilter * !SimpleFilter { triggersHolder.handleableCallbackQueriesDataHolder.isHandled(it) }, @@ -43,8 +44,9 @@ suspend fun BC.onUnhandledDataCallbackQuery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ @@ -52,7 +54,7 @@ suspend fun BC.onUnhandledDataCallbackQuery( suspend fun BC.onUnhandledInlineMessageIdDataCallbackQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery ( initialFilter * !SimpleFilter { triggersHolder.handleableCallbackQueriesDataHolder.isHandled(it) }, @@ -68,8 +70,9 @@ suspend fun BC.onUnhandledInlineMessageIdDataCallbackQue * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ @@ -77,7 +80,7 @@ suspend fun BC.onUnhandledInlineMessageIdDataCallbackQue suspend fun BC.onUnhandledMessageDataCallbackQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, - markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery( initialFilter * !SimpleFilter { triggersHolder.handleableCallbackQueriesDataHolder.isHandled(it) }, diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatBoostRemovedTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatBoostRemovedTriggers.kt index 3dae6f99ef..84514846d0 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatBoostRemovedTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatBoostRemovedTriggers.kt @@ -19,15 +19,16 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onChatBoostRemoved( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByIdChatBoostRemovedMarkerFactory, + markerFactory: MarkerFactory? = ByIdChatBoostRemovedMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { (it.chatBoostRemovedUpdateOrNull() ?.data) ?.let(::listOfNotNull) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatBoostUpdatedTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatBoostUpdatedTriggers.kt index 5e94dab7ce..1dc75a2d41 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatBoostUpdatedTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatBoostUpdatedTriggers.kt @@ -19,15 +19,16 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onChatBoostUpdated( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByIdChatBoostUpdatedMarkerFactory, + markerFactory: MarkerFactory? = ByIdChatBoostUpdatedMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { (it.chatBoostUpdatedUpdateOrNull() ?.data) ?.let(::listOfNotNull) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatJoinRequestTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatJoinRequestTriggers.kt index 21cbd37159..067c35fa3e 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatJoinRequestTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatJoinRequestTriggers.kt @@ -17,15 +17,16 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onChatJoinRequest( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByChatChatJoinRequestMarkerFactory, + markerFactory: MarkerFactory? = ByChatChatJoinRequestMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { (it.chatJoinRequestUpdateOrNull() ?.data) ?.let(::listOfNotNull) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatMemberUpdatedTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatMemberUpdatedTriggers.kt index bdfec02d1a..e963b4651c 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatMemberUpdatedTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatMemberUpdatedTriggers.kt @@ -17,7 +17,7 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update internal suspend inline fun BC.onChatMemberUpdatedInternal( initialFilter: SimpleFilter? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, - markerFactory: MarkerFactory = ByChatChatMemberUpdatedMarkerFactory, + markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { ((it as? U) ?.data) ?.let(::listOfNotNull) @@ -31,15 +31,16 @@ internal suspend inline fun BC.onChatMemberUpdated( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, - markerFactory: MarkerFactory = ByChatChatMemberUpdatedMarkerFactory, + markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onChatMemberUpdatedInternal( initialFilter, @@ -55,15 +56,16 @@ suspend fun BC.onChatMemberUpdated( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onCommonChatMemberUpdated( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, - markerFactory: MarkerFactory = ByChatChatMemberUpdatedMarkerFactory, + markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onChatMemberUpdatedInternal( initialFilter, @@ -79,15 +81,16 @@ suspend fun BC.onCommonChatMemberUpdated( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onMyChatMemberUpdated( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, - markerFactory: MarkerFactory = ByChatChatMemberUpdatedMarkerFactory, + markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onChatMemberUpdatedInternal( initialFilter, diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatMessageReactionCountUpdatedUpdatesTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatMessageReactionCountUpdatedUpdatesTriggers.kt index 9db5e94a07..8a172e0906 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatMessageReactionCountUpdatedUpdatesTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatMessageReactionCountUpdatedUpdatesTriggers.kt @@ -23,15 +23,16 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onChatMessageReactionsCountUpdated( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByChatIdChatMessageReactionsCountUpdatedMarkerFactory, + markerFactory: MarkerFactory? = ByChatIdChatMessageReactionsCountUpdatedMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { (it.chatMessageReactionsCountUpdatedUpdateOrNull() ?.data) ?.let(::listOfNotNull) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatMessageReactionUpdatedUpdatesTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatMessageReactionUpdatedUpdatesTriggers.kt index fcad229211..d822f6bb9d 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatMessageReactionUpdatedUpdatesTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatMessageReactionUpdatedUpdatesTriggers.kt @@ -15,7 +15,7 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update internal suspend inline fun BC.onChatMessageReactionUpdated( initialFilter: SimpleFilter? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByChatIdChatMessageReactionUpdatedMarkerFactory, + markerFactory: MarkerFactory? = ByChatIdChatMessageReactionUpdatedMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { (it.chatMessageReactionUpdatedUpdateOrNull() ?.data as? T) ?.let(::listOfNotNull) @@ -28,15 +28,16 @@ internal suspend inline fun BC.onChatMessageReactionUpdatedByUser( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByChatIdChatMessageReactionUpdatedMarkerFactory, + markerFactory: MarkerFactory? = ByChatIdChatMessageReactionUpdatedMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onChatMessageReactionUpdated( initialFilter, @@ -52,15 +53,16 @@ suspend fun BC.onChatMessageReactionUpdatedByUser( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onChatMessageReactionUpdatedByChat( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByChatIdChatMessageReactionUpdatedMarkerFactory, + markerFactory: MarkerFactory? = ByChatIdChatMessageReactionUpdatedMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onChatMessageReactionUpdated( initialFilter, @@ -76,15 +78,16 @@ suspend fun BC.onChatMessageReactionUpdatedByChat( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onChatMessageReactionUpdatedUnknown( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByChatIdChatMessageReactionUpdatedMarkerFactory, + markerFactory: MarkerFactory? = ByChatIdChatMessageReactionUpdatedMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onChatMessageReactionUpdated( initialFilter, diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChosenInlineResultTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChosenInlineResultTriggers.kt index b4f7a00dfa..0d3b24dec6 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChosenInlineResultTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChosenInlineResultTriggers.kt @@ -13,7 +13,7 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update internal suspend inline fun BC.onChosenInlineResultBase( initialFilter: SimpleFilter? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByUserIdChosenInlineResultMarkerFactory, + markerFactory: MarkerFactory? = ByUserIdChosenInlineResultMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { (it.chosenInlineResultUpdateOrNull() ?.data as? T) ?.let(::listOfNotNull) @@ -26,15 +26,16 @@ internal suspend inline fun BC.onChosenInlineResult( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByUserIdChosenInlineResultMarkerFactory, + markerFactory: MarkerFactory? = ByUserIdChosenInlineResultMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onChosenInlineResultBase( initialFilter, @@ -50,15 +51,16 @@ suspend fun BC.onChosenInlineResult( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onLocationChosenInlineResult( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByUserIdChosenInlineResultMarkerFactory, + markerFactory: MarkerFactory? = ByUserIdChosenInlineResultMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onChosenInlineResultBase( initialFilter, @@ -74,15 +76,16 @@ suspend fun BC.onLocationChosenInlineResult( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onBaseChosenInlineResult( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByUserIdChosenInlineResultMarkerFactory, + markerFactory: MarkerFactory? = ByUserIdChosenInlineResultMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onChosenInlineResultBase( initialFilter, diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CommandHandling.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CommandHandling.kt index bad353d964..b791581b99 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CommandHandling.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CommandHandling.kt @@ -25,7 +25,7 @@ internal suspend fun BC.commandUncounted( requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ): Job = onText( CommonMessageFilter { message -> @@ -52,7 +52,7 @@ suspend fun BC.command( requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ): Job = runCatchingSafely { commandUncounted( @@ -76,56 +76,86 @@ suspend fun BC.command( } }.getOrThrow() +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.command( command: String, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = command(command.toRegex(), requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.command( botCommand: BotCommand, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = command(botCommand.command, requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onCommand( commandRegex: Regex, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ): Job = command(commandRegex, requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onCommand( command: String, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ): Job = onCommand(command.toRegex(), requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onCommand( botCommand: BotCommand, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ): Job = onCommand(botCommand.command, requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.commandWithArgs( commandRegex: Regex, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver> ) = command( @@ -142,11 +172,16 @@ suspend fun BC.commandWithArgs( scenarioReceiver(it, args) } +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.commandWithArgs( command: String, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver> ) = commandWithArgs( @@ -158,11 +193,16 @@ suspend fun BC.commandWithArgs( scenarioReceiver = scenarioReceiver ) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.commandWithArgs( botCommand: BotCommand, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver> ) = commandWithArgs( @@ -174,11 +214,16 @@ suspend fun BC.commandWithArgs( scenarioReceiver = scenarioReceiver ) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.commandWithNamedArgs( commandRegex: Regex, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex, nameArgSeparator: Regex = TelegramBotCommandsDefaults.defaultNamesArgsSeparatorRegex, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver>> @@ -196,11 +241,16 @@ suspend fun BC.commandWithNamedArgs( scenarioReceiver(it, args) } +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.commandWithNamedArgs( command: String, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex, nameArgSeparator: Regex = TelegramBotCommandsDefaults.defaultNamesArgsSeparatorRegex, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver>> @@ -214,11 +264,16 @@ suspend fun BC.commandWithNamedArgs( scenarioReceiver = scenarioReceiver ) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.commandWithNamedArgs( botCommand: BotCommand, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex, nameArgSeparator: Regex = TelegramBotCommandsDefaults.defaultNamesArgsSeparatorRegex, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver>> @@ -232,11 +287,16 @@ suspend fun BC.commandWithNamedArgs( scenarioReceiver = scenarioReceiver ) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onCommandWithArgs( commandRegex: Regex, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver> ): Job = commandWithArgs( @@ -248,11 +308,16 @@ suspend fun BC.onCommandWithArgs( scenarioReceiver = scenarioReceiver ) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onCommandWithArgs( command: String, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver> ): Job = onCommandWithArgs( @@ -264,11 +329,16 @@ suspend fun BC.onCommandWithArgs( scenarioReceiver = scenarioReceiver ) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onCommandWithArgs( botCommand: BotCommand, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver> ): Job = onCommandWithArgs( @@ -280,11 +350,16 @@ suspend fun BC.onCommandWithArgs( scenarioReceiver = scenarioReceiver ) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onCommandWithNamedArgs( commandRegex: Regex, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex, nameArgSeparator: Regex = TelegramBotCommandsDefaults.defaultNamesArgsSeparatorRegex, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver>> @@ -298,11 +373,16 @@ suspend fun BC.onCommandWithNamedArgs( scenarioReceiver = scenarioReceiver, ) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onCommandWithNamedArgs( command: String, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex, nameArgSeparator: Regex = TelegramBotCommandsDefaults.defaultNamesArgsSeparatorRegex, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver>> @@ -316,11 +396,16 @@ suspend fun BC.onCommandWithNamedArgs( scenarioReceiver = scenarioReceiver ) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onCommandWithNamedArgs( botCommand: BotCommand, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex, nameArgSeparator: Regex = TelegramBotCommandsDefaults.defaultNamesArgsSeparatorRegex, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver>> diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CommandHandlingUnhandled.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CommandHandlingUnhandled.kt index de00275251..8eb4a0805d 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CommandHandlingUnhandled.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CommandHandlingUnhandled.kt @@ -16,12 +16,17 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update import dev.inmo.tgbotapi.utils.PreviewFeature import kotlinx.coroutines.Job +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ @PreviewFeature suspend fun BC.unhandledCommand( requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ): Job = onText( CommonMessageFilter { message -> @@ -44,20 +49,30 @@ suspend fun BC.unhandledCommand( scenarioReceiver ) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ @PreviewFeature suspend fun BC.onUnhandledCommand( requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ): Job = unhandledCommand(requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ @PreviewFeature suspend fun BC.unhandledCommandWithArgs( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver>> ) = onUnhandledCommand( requireOnlyCommandInMessage = false, @@ -71,10 +86,15 @@ suspend fun BC.unhandledCommandWithArgs( scenarioReceiver(it, args) } +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ @PreviewFeature suspend fun BC.onUnhandledCommandWithArgs( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver>> ): Job = unhandledCommandWithArgs(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ContentTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ContentTriggers.kt index 5d66a1ed66..32a0d90bb6 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ContentTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ContentTriggers.kt @@ -9,6 +9,7 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByChatMessageMarkerFactory import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory import dev.inmo.tgbotapi.extensions.utils.whenCommonMessage +import dev.inmo.tgbotapi.extensions.utils.withContentOrNull import dev.inmo.tgbotapi.types.files.TelegramMediaFile import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage import dev.inmo.tgbotapi.types.message.content.* @@ -20,14 +21,14 @@ typealias CommonMessageFilter = SimpleFilter> internal suspend inline fun BC.onContentMessageWithType( initialFilter: CommonMessageFilter? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { when (it) { is BaseSentMessageUpdate -> it.data.whenCommonMessage(::listOfNotNull) else -> null } ?.mapNotNull { message -> - if (message.content is T) message as CommonMessage else null + message.withContentOrNull() } } @@ -39,15 +40,16 @@ internal suspend inline fun * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onContentMessage( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onContentMessageWithType( initialFilter, @@ -63,15 +65,16 @@ suspend fun BC.onContentMessage( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onContact( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -87,15 +90,16 @@ suspend fun BC.onContact( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onDice( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -111,15 +115,16 @@ suspend fun BC.onDice( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onGame( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -135,15 +140,16 @@ suspend fun BC.onGame( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onLocation( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -159,15 +165,16 @@ suspend fun BC.onLocation( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onLiveLocation( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -183,15 +190,16 @@ suspend fun BC.onLiveLocation( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onStaticLocation( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -207,15 +215,16 @@ suspend fun BC.onStaticLocation( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onPoll( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -231,15 +240,16 @@ suspend fun BC.onPoll( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onText( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -255,15 +265,16 @@ suspend fun BC.onText( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onStory( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -279,15 +290,16 @@ suspend fun BC.onStory( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onTextedContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -303,15 +315,16 @@ suspend fun BC.onTextedContent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onVenue( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -327,15 +340,16 @@ suspend fun BC.onVenue( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onAudioMediaGroup( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -351,15 +365,16 @@ suspend fun BC.onAudioMediaGroup( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onDocumentMediaGroupContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -375,15 +390,16 @@ suspend fun BC.onDocumentMediaGroupContent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onTextedMediaContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -399,15 +415,16 @@ suspend fun BC.onTextedMediaContent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onMediaCollection( initialFilter: CommonMessageFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onContentMessageWithType( initialFilter, @@ -423,15 +440,16 @@ suspend fun BC.onMediaCollection( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onMedia( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -447,15 +465,16 @@ suspend fun BC.onMedia( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onAnimation( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -471,15 +490,16 @@ suspend fun BC.onAnimation( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onAudio( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -495,15 +515,16 @@ suspend fun BC.onAudio( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onDocument( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -519,15 +540,16 @@ suspend fun BC.onDocument( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onPhoto( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -543,15 +565,16 @@ suspend fun BC.onPhoto( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onSticker( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -567,15 +590,16 @@ suspend fun BC.onSticker( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onVideo( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -591,15 +615,16 @@ suspend fun BC.onVideo( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onVideoNote( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -615,15 +640,16 @@ suspend fun BC.onVideoNote( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onVoice( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -639,15 +665,16 @@ suspend fun BC.onVoice( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onInvoice( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -663,15 +690,16 @@ suspend fun BC.onInvoice( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onVisualContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -687,15 +715,16 @@ suspend fun BC.onVisualContent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onMediaContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -711,15 +740,16 @@ suspend fun BC.onMediaContent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onGiveawayContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, @@ -736,15 +766,16 @@ suspend fun BC.onGiveawayContent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onGiveawayPublicResultsContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( initialFilter, diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/DeepLinkHandling.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/DeepLinkHandling.kt index 91b1f03872..4862909143 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/DeepLinkHandling.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/DeepLinkHandling.kt @@ -21,7 +21,7 @@ private val startRegex = Regex("start") suspend fun BC.onDeepLink( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = { (message, _), update -> MessageFilterByChat(this, message, update) }, - markerFactory: MarkerFactory, Any> = MarkerFactory { (message, _) -> ByChatMessageMarkerFactory(message) }, + markerFactory: MarkerFactory, Any>? = MarkerFactory { (message, _) -> ByChatMessageMarkerFactory(message) }, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ): Job = on( markerFactory, @@ -43,11 +43,16 @@ suspend fun BC.onDeepLink( } } +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onDeepLink( regex: Regex, initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = { (message, _), update -> MessageFilterByChat(this, message, update) }, - markerFactory: MarkerFactory, Any> = MarkerFactory { (message, _) -> ByChatMessageMarkerFactory(message) }, + markerFactory: MarkerFactory, Any>? = MarkerFactory { (message, _) -> ByChatMessageMarkerFactory(message) }, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ): Job { val internalFilter = SimpleFilter> { @@ -56,10 +61,15 @@ suspend fun BC.onDeepLink( return onDeepLink(initialFilter ?.let { internalFilter * it } ?: internalFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) } +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onDeepLink( deepLink: String, initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = { (message, _), update -> MessageFilterByChat(this, message, update) }, - markerFactory: MarkerFactory, Any> = MarkerFactory { (message, _) -> ByChatMessageMarkerFactory(message) }, + markerFactory: MarkerFactory, Any>? = MarkerFactory { (message, _) -> ByChatMessageMarkerFactory(message) }, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ): Job = onDeepLink(Regex("^$deepLink$"), initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/DeletedBusinessMessagesTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/DeletedBusinessMessagesTriggers.kt index 3e5b2be96a..b8e8da2127 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/DeletedBusinessMessagesTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/DeletedBusinessMessagesTriggers.kt @@ -22,15 +22,16 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onBusinessMessagesDeleted( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByBusinessConnectionIdBusinessMessagesDeletedMarkerFactory, + markerFactory: MarkerFactory? = ByBusinessConnectionIdBusinessMessagesDeletedMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { (it.deletedBusinessMessageUpdateOrNull() ?.data) ?.let(::listOfNotNull) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EditedContentTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EditedContentTriggers.kt index 1978e5540f..9d8b508b7f 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EditedContentTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EditedContentTriggers.kt @@ -17,7 +17,7 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update internal suspend inline fun BC.onEditedContent( initialFilter: CommonMessageFilter? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { it.baseEditMessageUpdateOrNull() ?.data ?.withContent() ?.let(::listOfNotNull) @@ -31,15 +31,16 @@ internal suspend inline fun * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedContentMessage( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> )= onEditedContent( initialFilter, @@ -55,15 +56,16 @@ suspend fun BC.onEditedContentMessage( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedContact( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -79,15 +81,16 @@ suspend fun BC.onEditedContact( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedDice( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -103,15 +106,16 @@ suspend fun BC.onEditedDice( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedGame( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -127,15 +131,16 @@ suspend fun BC.onEditedGame( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedLocation( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -151,15 +156,16 @@ suspend fun BC.onEditedLocation( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedText( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -175,15 +181,16 @@ suspend fun BC.onEditedText( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedVenue( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -199,15 +206,16 @@ suspend fun BC.onEditedVenue( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedAudioMediaGroup( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -223,15 +231,16 @@ suspend fun BC.onEditedAudioMediaGroup( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedDocumentMediaGroupContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -247,15 +256,16 @@ suspend fun BC.onEditedDocumentMediaGroupContent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedTextedMediaContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -271,15 +281,16 @@ suspend fun BC.onEditedTextedMediaContent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedMediaCollection( initialFilter: CommonMessageFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> )= onEditedContent( initialFilter, @@ -295,15 +306,16 @@ suspend fun BC.onEditedMediaCollection( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedMedia( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -319,15 +331,16 @@ suspend fun BC.onEditedMedia( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedAnimation( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -343,15 +356,16 @@ suspend fun BC.onEditedAnimation( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedAudio( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -367,15 +381,16 @@ suspend fun BC.onEditedAudio( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedDocument( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -391,15 +406,16 @@ suspend fun BC.onEditedDocument( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedPhoto( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -415,15 +431,16 @@ suspend fun BC.onEditedPhoto( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedSticker( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -439,15 +456,16 @@ suspend fun BC.onEditedSticker( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedVideo( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -463,15 +481,16 @@ suspend fun BC.onEditedVideo( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedVideoNote( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -487,15 +506,16 @@ suspend fun BC.onEditedVideoNote( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedVoice( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, @@ -511,15 +531,16 @@ suspend fun BC.onEditedVoice( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onEditedInvoice( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( initialFilter, diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EventTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EventTriggers.kt index eb60a8b17f..8ff4fc5aaa 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EventTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EventTriggers.kt @@ -33,7 +33,7 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update internal suspend inline fun BC.onEvent( initialFilter: SimpleFilter>? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { @Suppress("UNCHECKED_CAST") @@ -43,7 +43,7 @@ internal suspend inline fun BC.on internal suspend inline fun > BC.onEventWithCustomChatEventMessage( initialFilter: SimpleFilter? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { @Suppress("UNCHECKED_CAST") @@ -57,15 +57,16 @@ internal suspend inline fun BC.onChannelEvent( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -76,15 +77,16 @@ suspend fun BC.onChannelEvent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onPrivateEvent( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -95,15 +97,16 @@ suspend fun BC.onPrivateEvent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onChatEvent( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -114,15 +117,16 @@ suspend fun BC.onChatEvent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onVideoChatEvent( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -133,15 +137,16 @@ suspend fun BC.onVideoChatEvent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onVideoChatStartedEvent( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -152,15 +157,16 @@ suspend fun BC.onVideoChatStartedEvent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onVideoChatEndedEvent( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -171,15 +177,16 @@ suspend fun BC.onVideoChatEndedEvent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onVideoChatParticipantsInvitedEvent( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -190,15 +197,16 @@ suspend fun BC.onVideoChatParticipantsInvitedEvent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onMessageAutoDeleteTimerChangedEvent( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -209,15 +217,16 @@ suspend fun BC.onMessageAutoDeleteTimerChangedEvent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onPublicChatEvent( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -228,15 +237,16 @@ suspend fun BC.onPublicChatEvent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onCommonEvent( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -247,15 +257,16 @@ suspend fun BC.onCommonEvent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onGroupEvent( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -266,15 +277,16 @@ suspend fun BC.onGroupEvent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onSupergroupEvent( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -285,15 +297,16 @@ suspend fun BC.onSupergroupEvent( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onChannelChatCreated( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -304,15 +317,16 @@ suspend fun BC.onChannelChatCreated( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onDeleteChatPhoto( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -323,15 +337,16 @@ suspend fun BC.onDeleteChatPhoto( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onGroupChatCreated( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -342,15 +357,16 @@ suspend fun BC.onGroupChatCreated( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onLeftChatMember( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -361,15 +377,16 @@ suspend fun BC.onLeftChatMember( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onNewChatMembers( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -380,15 +397,16 @@ suspend fun BC.onNewChatMembers( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onNewChatPhoto( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -399,15 +417,16 @@ suspend fun BC.onNewChatPhoto( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onNewChatTitle( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -418,15 +437,16 @@ suspend fun BC.onNewChatTitle( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onPinnedMessage( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -437,15 +457,16 @@ suspend fun BC.onPinnedMessage( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onProximityAlertTriggered( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -456,15 +477,16 @@ suspend fun BC.onProximityAlertTriggered( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onSupergroupChatCreated( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -478,15 +500,16 @@ suspend fun BC.onSupergroupChatCreated( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onSuccessfulPayment( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -497,15 +520,16 @@ suspend fun BC.onSuccessfulPayment( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onUserLoggedIn( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -516,15 +540,16 @@ suspend fun BC.onUserLoggedIn( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onWebAppData( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -535,15 +560,16 @@ suspend fun BC.onWebAppData( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onForumTopicClosed( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -554,15 +580,16 @@ suspend fun BC.onForumTopicClosed( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onForumTopicCreated( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -573,15 +600,16 @@ suspend fun BC.onForumTopicCreated( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onForumTopicReopened( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -593,15 +621,16 @@ suspend fun BC.onForumTopicReopened( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onForumTopicEdited( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -612,15 +641,16 @@ suspend fun BC.onForumTopicEdited( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onGeneralForumTopicHidden( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -631,15 +661,16 @@ suspend fun BC.onGeneralForumTopicHidden( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onGeneralForumTopicUnhidden( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -651,15 +682,16 @@ suspend fun BC.onGeneralForumTopicUnhidden( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onWriteAccessAllowed( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -671,15 +703,16 @@ suspend fun BC.onWriteAccessAllowed( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onWriteAccessAllowedFromRequest( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -691,15 +724,16 @@ suspend fun BC.onWriteAccessAllowedFromRequest( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onWriteAccessAllowedFromAttachmentMenu( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -711,15 +745,16 @@ suspend fun BC.onWriteAccessAllowedFromAttachmentMenu( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onWriteAccessAllowedOther( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -731,15 +766,16 @@ suspend fun BC.onWriteAccessAllowedOther( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onWriteAccessAllowedFromWebAppLink( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -752,15 +788,16 @@ suspend fun BC.onWriteAccessAllowedFromWebAppLink( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onChatSharedRequest( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -772,15 +809,16 @@ suspend fun BC.onChatSharedRequest( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onUsersShared( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -792,15 +830,16 @@ suspend fun BC.onUsersShared( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onUserShared( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onUsersShared(initialFilter * { it.chatEvent.userIds.size == 1 }, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -813,15 +852,16 @@ suspend fun BC.onUserShared( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onChatShared( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -834,15 +874,16 @@ suspend fun BC.onChatShared( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onChatBoostAdded( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -854,14 +895,15 @@ suspend fun BC.onChatBoostAdded( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onChatBackgroundSet( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/InlineQueryTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/InlineQueryTriggers.kt index 8106a24084..69518e093f 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/InlineQueryTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/InlineQueryTriggers.kt @@ -12,7 +12,7 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update internal suspend inline fun BC.onInlineQuery( initialFilter: SimpleFilter? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = InlineQueryFilterByUser, - markerFactory: MarkerFactory = ByUserInlineQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserInlineQueryMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { (it.inlineQueryUpdateOrNull() ?.data as? T) ?.let(::listOfNotNull) @@ -25,15 +25,16 @@ internal suspend inline fun BC. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onAnyInlineQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = InlineQueryFilterByUser, - markerFactory: MarkerFactory = ByUserInlineQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserInlineQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onInlineQuery(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -45,15 +46,16 @@ suspend fun BC.onAnyInlineQuery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onBaseInlineQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = InlineQueryFilterByUser, - markerFactory: MarkerFactory = ByUserInlineQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserInlineQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onInlineQuery(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -65,14 +67,15 @@ suspend fun BC.onBaseInlineQuery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onLocationInlineQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = InlineQueryFilterByUser, - markerFactory: MarkerFactory = ByUserInlineQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserInlineQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onInlineQuery(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MainTrigger.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MainTrigger.kt index 80c386c70c..1492cacaa1 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MainTrigger.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MainTrigger.kt @@ -1,5 +1,7 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling +import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions +import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptionsAsync import dev.inmo.tgbotapi.extensions.behaviour_builder.* import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.expectFlow @@ -7,12 +9,12 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory import dev.inmo.tgbotapi.types.update.abstracts.Update -internal suspend inline fun BC.on( - markerFactory: MarkerFactory, +internal suspend fun BC.on( + markerFactory: MarkerFactory?, initialFilter: SimpleFilter? = null, - noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver, - noinline updateToData: (Update) -> List? + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, + scenarioReceiver: CustomBehaviourContextAndTypeReceiver, + updateToData: (Update) -> List? ) = flowsUpdatesFilter.expectFlow( bot, filter = initialFilter ?.let { @@ -22,19 +24,31 @@ internal suspend inline fun BC.on( } ?: emptyList() } } ?: { - updateToData(it) ?.mapNotNull { data -> + updateToData(it) ?.map { data -> it to data } ?: emptyList() } -).subscribeSafelyWithoutExceptionsAsync( - scope, - { markerFactory(it.second) } -) { (update, triggerData) -> - createSubContextAndDoWithUpdatesFilter( - stopOnCompletion = false - ) { - if (subcontextUpdatesFilter ?.invoke(this, triggerData, update) != false) { - scenarioReceiver(triggerData) +).run { + val handler: suspend (Pair) -> Unit = subcontextUpdatesFilter ?.let { + { (update, triggerData) -> + createSubContextAndDoWithUpdatesFilter { + if (subcontextUpdatesFilter(this, triggerData, update)) { + scenarioReceiver(triggerData) + } + } + } + } ?: { (_, triggerData) -> + createSubContextAndDoWithUpdatesFilter(behaviourContextReceiver = { scenarioReceiver(triggerData) }) + } + markerFactory ?.let { + subscribeSafelyWithoutExceptionsAsync( + scope, + { markerFactory(it.second) }, + block = handler + ) + } ?: subscribeSafelyWithoutExceptions(scope) { + scope.launchSafelyWithoutExceptions { + handler(it) } } } diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupMessagesTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupMessagesTriggers.kt index b4f80f4fd5..ef23f4913d 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupMessagesTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupMessagesTriggers.kt @@ -18,7 +18,7 @@ import dev.inmo.tgbotapi.utils.PreviewFeature internal suspend inline fun BC.buildMediaGroupMessagesTrigger( initialFilter: SimpleFilter>? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { it.baseSentMessageUpdateOrNull() ?.data ?.commonMessageOrNull() ?.withContentOrNull>() ?.let { @@ -37,15 +37,16 @@ internal suspend inline fun BC.onMediaGroupMessages( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = buildMediaGroupMessagesTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -56,15 +57,16 @@ suspend fun BC.onMediaGroupMessages( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onPlaylistMessages( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = buildMediaGroupMessagesTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -75,15 +77,16 @@ suspend fun BC.onPlaylistMessages( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onDocumentsGroupMessages( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = buildMediaGroupMessagesTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -94,15 +97,16 @@ suspend fun BC.onDocumentsGroupMessages( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onVisualGalleryMessages( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = buildMediaGroupMessagesTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -113,15 +117,16 @@ suspend fun BC.onVisualGalleryMessages( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onVisualMediaGroupMessages( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onVisualGalleryMessages(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -132,15 +137,16 @@ suspend fun BC.onVisualMediaGroupMessages( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onPhotoGalleryMessages( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = buildMediaGroupMessagesTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -151,14 +157,15 @@ suspend fun BC.onPhotoGalleryMessages( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onVideoGalleryMessages( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = buildMediaGroupMessagesTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupTriggers.kt index 16057119ae..ec5ea5f21b 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupTriggers.kt @@ -18,7 +18,7 @@ import dev.inmo.tgbotapi.utils.PreviewFeature internal suspend inline fun BC.buildMediaGroupTrigger( initialFilter: SimpleFilter>? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { it.baseSentMessageUpdateOrNull() ?.data ?.commonMessageOrNull() ?.withContentOrNull>() ?.let { @@ -37,15 +37,16 @@ internal suspend inline fun BC.onMediaGroup( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -56,15 +57,16 @@ suspend fun BC.onMediaGroup( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onPlaylist( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -75,15 +77,16 @@ suspend fun BC.onPlaylist( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onDocumentsGroup( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -94,15 +97,16 @@ suspend fun BC.onDocumentsGroup( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onVisualGallery( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -113,15 +117,16 @@ suspend fun BC.onVisualGallery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onVisualMediaGroup( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onVisualGallery(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -132,15 +137,16 @@ suspend fun BC.onVisualMediaGroup( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onPhotoGallery( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -151,14 +157,15 @@ suspend fun BC.onPhotoGallery( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onVideoGallery( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MentionTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MentionTriggers.kt index 1acc11d2dc..f93ac56d7f 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MentionTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MentionTriggers.kt @@ -29,7 +29,7 @@ internal suspend inline fun B username: Username, initialFilter: CommonMessageFilter? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onContentMessageWithType( initialFilter * { @@ -44,7 +44,7 @@ internal suspend inline fun B userId: UserId, initialFilter: CommonMessageFilter? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onContentMessageWithType( initialFilter * { @@ -59,7 +59,7 @@ internal suspend inline fun B user: User, initialFilter: CommonMessageFilter? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onContentMessageWithType( initialFilter * { @@ -71,287 +71,452 @@ internal suspend inline fun B ) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithAnyContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(username, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onTextMentionWithAnyContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onTextMention(userId, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithAnyContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(user, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithVoiceContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(username, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onTextMentionWithVoiceContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onTextMention(userId, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithVoiceContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(user, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithMediaGroupContent( username: Username, initialFilter: CommonMessageFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver>, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver>> ) = onMention(username, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onTextMentionWithMediaGroupContent( userId: UserId, initialFilter: CommonMessageFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver>, Update>? = null, - markerFactory: MarkerFactory>, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory>, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver>> ) = onTextMention(userId, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithMediaGroupContent( user: User, initialFilter: CommonMessageFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver>, Update>? = null, - markerFactory: MarkerFactory>, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory>, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver>> ) = onMention(user, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithMediaGroupPartContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(username, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onTextMentionWithMediaGroupPartContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onTextMention(userId, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithMediaGroupPartContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(user, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithAudioContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(username, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onTextMentionWithAudioContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onTextMention(userId, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithAudioContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(user, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithDocumentContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(username, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onTextMentionWithDocumentContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onTextMention(userId, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithDocumentContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(user, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithVisualMediaGroupPartContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(username, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onTextMentionWithVisualMediaGroupPartContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onTextMention(userId, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithVisualMediaGroupPartContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(user, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithVideoContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(username, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onTextMentionWithVideoContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onTextMention(userId, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithVideoContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(user, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithPhotoContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(username, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onTextMentionWithPhotoContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onTextMention(userId, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithPhotoContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(user, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithAnimationContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(username, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onTextMentionWithAnimationContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onTextMention(userId, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithAnimationContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(user, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithTextContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(username, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onTextMentionWithTextContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onTextMention(userId, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) +/** + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" + */ suspend fun BC.onMentionWithTextContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, - markerFactory: MarkerFactory, Any> = AnyMarkerFactory(), + markerFactory: MarkerFactory, Any>? = AnyMarkerFactory(), scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onMention(user, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PassportTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PassportTriggers.kt index b4cd034da8..608690b12f 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PassportTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PassportTriggers.kt @@ -14,7 +14,7 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update internal suspend inline fun BC.onPassportMessageWith( initialFilter: SimpleFilter? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { (it.messageUpdateOrNull() ?.data ?.passportMessageOrNull() ?.takeIf { it.passportData.data.any { it is T } }) ?.let(::listOfNotNull) @@ -28,15 +28,16 @@ internal suspend inline fun BC.onPassportMessage( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, - markerFactory: MarkerFactory = ByChatMessageMarkerFactory, + markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onPassportMessageWith( initialFilter, diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PollAnswersTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PollAnswersTriggers.kt index a09639754b..25aacba2f8 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PollAnswersTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PollAnswersTriggers.kt @@ -13,7 +13,7 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update internal suspend inline fun BC.onPollAnswered( initialFilter: SimpleFilter? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByIdPollAnswerMarkerFactory, + markerFactory: MarkerFactory? = ByIdPollAnswerMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { (it.pollAnswerUpdateOrNull() ?.data) ?.let(::listOfNotNull) @@ -26,15 +26,16 @@ internal suspend inline fun BC.onPollAnswered( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onPollAnswer( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByIdPollAnswerMarkerFactory, + markerFactory: MarkerFactory? = ByIdPollAnswerMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onPollAnswered( initialFilter, diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PollUpdatesTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PollUpdatesTriggers.kt index c9098d600d..f7ce9810b5 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PollUpdatesTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PollUpdatesTriggers.kt @@ -13,7 +13,7 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update internal suspend inline fun BC.onPollUpdatedBase( initialFilter: SimpleFilter? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByIdPollMarkerFactory, + markerFactory: MarkerFactory? = ByIdPollMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { (it.pollUpdateOrNull() ?.data as? T) ?.let(::listOfNotNull) @@ -26,15 +26,16 @@ internal suspend inline fun BC.onPollU * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onPollUpdates( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByIdPollMarkerFactory, + markerFactory: MarkerFactory? = ByIdPollMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onPollUpdatedBase( initialFilter, @@ -50,15 +51,16 @@ suspend fun BC.onPollUpdates( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onRegularPollUpdates( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByIdPollMarkerFactory, + markerFactory: MarkerFactory? = ByIdPollMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onPollUpdatedBase( initialFilter, @@ -74,15 +76,16 @@ suspend fun BC.onRegularPollUpdates( * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onQuizPollUpdates( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, - markerFactory: MarkerFactory = ByIdPollMarkerFactory, + markerFactory: MarkerFactory? = ByIdPollMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onPollUpdatedBase( initialFilter, diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PreCheckoutQueryTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PreCheckoutQueryTriggers.kt index c53f1ecda0..8b2bb853e7 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PreCheckoutQueryTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PreCheckoutQueryTriggers.kt @@ -20,15 +20,16 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onPreCheckoutQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = PreCheckoutQueryFilterByUser, - markerFactory: MarkerFactory = ByUserPreCheckoutQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserPreCheckoutQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { (it.preCheckoutQueryUpdateOrNull() ?.data) ?.let(::listOfNotNull) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ShippingQueryTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ShippingQueryTriggers.kt index 1f82cf12cb..bc2aa01ba5 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ShippingQueryTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ShippingQueryTriggers.kt @@ -20,15 +20,16 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters - * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously - * in one "stream". Output of [markerFactory] will be used as a key for "stream" + * @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream". + * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for + * "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun BC.onShippingQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ShippingQueryFilterByUser, - markerFactory: MarkerFactory = ByUserShippingQueryMarkerFactory, + markerFactory: MarkerFactory? = ByUserShippingQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { (it.shippingQueryUpdateOrNull() ?.data) ?.let(::listOfNotNull)