From 1ef49ad48c8fb9dd0356f3c57ca4075d6244ba7a Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 14 Jun 2025 19:11:18 +0600 Subject: [PATCH] remove suspend in all triggers --- .../behaviour_builder/BehaviourContext.kt | 53 +++++++++++- .../expectations/WaitContent.kt | 4 +- .../expectations/WaitContentMessage.kt | 4 +- .../CallbackQueryTriggers.kt | 30 +++---- .../ChatMemberUpdatedTriggers.kt | 58 ++++++------- .../triggers_handling/CommandHandling.kt | 81 +++++++++--------- .../triggers_handling/ContentTriggers.kt | 44 +++++----- .../triggers_handling/DeepLinkHandling.kt | 44 +++++----- .../EditedContentTriggers.kt | 24 +++--- .../triggers_handling/EventTriggers.kt | 82 +++++++++---------- .../triggers_handling/MentionTriggers.kt | 48 +++++------ 11 files changed, 264 insertions(+), 208 deletions(-) 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 1fe1931612..483dbc6339 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 @@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder +import dev.inmo.kslog.common.KSLog import dev.inmo.micro_utils.coroutines.* import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.handlers_registrar.TriggersHolder @@ -153,12 +154,14 @@ fun BC.createSubContext( scope: CoroutineScope = LinkedSupervisorScope(), triggersHolder: TriggersHolder = this.triggersHolder, updatesUpstreamFlow: Flow = allUpdatesFlow, - subcontextInitialAction: CustomBehaviourContextAndTypeReceiver = this.subcontextInitialAction, + subcontextInitialAction: CustomBehaviourContextAndTypeReceiver = this.subcontextInitialAction, ) = copy( scope = scope, upstreamUpdatesFlow = updatesUpstreamFlow, triggersHolder = triggersHolder, - subcontextInitialAction = subcontextInitialAction + subcontextInitialAction = { + (this as BC).subcontextInitialAction(it) + } ) as BC /** @@ -174,6 +177,52 @@ suspend fun BC.doInContext( } } +/** + * Launch [behaviourContextReceiver] in context of [this] as [BehaviourContext] and as [kotlin.coroutines.CoroutineContext] + * + * [this] [BehaviourContext] will **NOT** be closed automatically + */ +suspend fun BC.doInNewSubContext( + scope: CoroutineScope = LinkedSupervisorScope(), + triggersHolder: TriggersHolder = this.triggersHolder, + updatesUpstreamFlow: Flow = allUpdatesFlow, + subcontextInitialAction: CustomBehaviourContextAndTypeReceiver = this.subcontextInitialAction, + behaviourContextReceiver: CustomBehaviourContextReceiver +): T { + return createSubContext( + scope = scope, + triggersHolder = triggersHolder, + updatesUpstreamFlow = updatesUpstreamFlow, + subcontextInitialAction = subcontextInitialAction + ).run { + behaviourContextReceiver() + } +} + +/** + * Launch [behaviourContextReceiver] in context of [this] as [BehaviourContext] and as [kotlin.coroutines.CoroutineContext] + * + * [this] [BehaviourContext] will **NOT** be closed automatically + */ +fun BC.launchInNewSubContext( + scope: CoroutineScope = LinkedSupervisorScope(), + triggersHolder: TriggersHolder = this.triggersHolder, + updatesUpstreamFlow: Flow = allUpdatesFlow, + subcontextInitialAction: CustomBehaviourContextAndTypeReceiver = this.subcontextInitialAction, + behaviourContextReceiver: CustomBehaviourContextReceiver +): Job { + return createSubContext( + scope = scope, + triggersHolder = triggersHolder, + updatesUpstreamFlow = updatesUpstreamFlow, + subcontextInitialAction = subcontextInitialAction + ).apply { + launchLoggingDropExceptions(logger = Log ?: KSLog) { + behaviourContextReceiver() + } + }.coroutineContext.job +} + /** * Creates new one [BehaviourContext] using [createSubContext] and launches [behaviourContextReceiver] in a new context * using [doInContext]. diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitContent.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitContent.kt index 27c5a98f7c..f58ef4db2c 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitContent.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitContent.kt @@ -16,9 +16,9 @@ import kotlinx.coroutines.flow.mapNotNull typealias CommonMessageToContentMapper = suspend CommonMessage.() -> T? @RiskFeature(lowLevelRiskFeatureMessage) -inline fun BehaviourContext.waitContent( +fun BehaviourContext.waitContent( initRequest: Request<*>? = null, - noinline errorFactory: NullableRequestBuilder<*> = { null } + errorFactory: NullableRequestBuilder<*> = { null } ): Flow = waitContentMessage(initRequest, errorFactory).map { it.content } inline fun Flow.mapContent() = mapNotNull { it as? T } diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitContentMessage.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitContentMessage.kt index efa2f7f0e7..e84e12c5ad 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitContentMessage.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitContentMessage.kt @@ -16,9 +16,9 @@ import kotlinx.coroutines.flow.mapNotNull typealias CommonMessageToCommonMessageMapper = suspend CommonMessage.() -> CommonMessage? @RiskFeature(lowLevelRiskFeatureMessage) -inline fun BehaviourContext.waitContentMessage( +fun BehaviourContext.waitContentMessage( initRequest: Request<*>? = null, - noinline errorFactory: NullableRequestBuilder<*> = { null } + errorFactory: NullableRequestBuilder<*> = { null } ): Flow> = expectFlow( initRequest, errorFactory 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 7f81c45725..faccc49787 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 @@ -38,18 +38,18 @@ internal inline fun BC.onCall * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -internal suspend inline fun BC.onDataCallbackQueryCounted( +internal inline fun BC.onDataCallbackQueryCounted( initialFilter: SimpleFilter? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, noinline additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver? = null, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver -): Job { +): Job = launchInNewSubContext { val newInitialFilter = SimpleFilter { - it is T && initialFilter ?.invoke(it) ?: true + it is T && initialFilter?.invoke(it) ?: true }::invoke - return runCatching { - onCallbackQuery ( + runCatching { + onCallbackQuery( initialFilter, subcontextUpdatesFilter, markerFactory, @@ -83,7 +83,7 @@ internal suspend inline fun BC.onDataCallbackQuery( +fun BC.onDataCallbackQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, @@ -112,7 +112,7 @@ suspend fun BC.onDataCallbackQuery( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onDataCallbackQuery( +fun BC.onDataCallbackQuery( dataRegex: Regex, initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, @@ -143,7 +143,7 @@ suspend fun BC.onDataCallbackQuery( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onDataCallbackQuery( +fun BC.onDataCallbackQuery( data: String, initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, @@ -226,7 +226,7 @@ fun BC.onInlineMessageIdCallbackQuery( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onInlineMessageIdDataCallbackQuery( +fun BC.onInlineMessageIdDataCallbackQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, @@ -255,7 +255,7 @@ suspend fun BC.onInlineMessageIdDataCallbackQuery( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onInlineMessageIdDataCallbackQuery( +fun BC.onInlineMessageIdDataCallbackQuery( dataRegex: Regex, initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, @@ -286,7 +286,7 @@ suspend fun BC.onInlineMessageIdDataCallbackQuery( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onInlineMessageIdDataCallbackQuery( +fun BC.onInlineMessageIdDataCallbackQuery( data: String, initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, @@ -369,7 +369,7 @@ fun BC.onMessageCallbackQuery( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMessageDataCallbackQuery( +fun BC.onMessageDataCallbackQuery( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, @@ -398,7 +398,7 @@ suspend fun BC.onMessageDataCallbackQuery( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMessageDataCallbackQuery( +fun BC.onMessageDataCallbackQuery( dataRegex: Regex, initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, @@ -429,7 +429,7 @@ suspend fun BC.onMessageDataCallbackQuery( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMessageDataCallbackQuery( +fun BC.onMessageDataCallbackQuery( data: String, initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, @@ -485,7 +485,7 @@ fun BC.onMessageGameShortNameCallbackQuery( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onUnknownCallbackQueryType( +fun BC.onUnknownCallbackQueryType( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, markerFactory: MarkerFactory? = ByUserCallbackQueryMarkerFactory, 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 50d0710b00..a418f4d23c 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 @@ -469,7 +469,7 @@ fun BC.onChatMemberGotUnrestricted( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onChatMemberKicked( +fun BC.onChatMemberKicked( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -496,7 +496,7 @@ suspend fun BC.onChatMemberKicked( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onCommonChatMemberJoined( +fun BC.onCommonChatMemberJoined( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -523,7 +523,7 @@ suspend fun BC.onCommonChatMemberJoined( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onCommonChatMemberLeft( +fun BC.onCommonChatMemberLeft( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -550,7 +550,7 @@ suspend fun BC.onCommonChatMemberLeft( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onCommonChatMemberSubscribed( +fun BC.onCommonChatMemberSubscribed( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -577,7 +577,7 @@ suspend fun BC.onCommonChatMemberSubscribed( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onCommonChatMemberSubscriptionChanged( +fun BC.onCommonChatMemberSubscriptionChanged( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -604,7 +604,7 @@ suspend fun BC.onCommonChatMemberSubscriptionChanged( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onCommonChatMemberUnsubscribed( +fun BC.onCommonChatMemberUnsubscribed( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -631,7 +631,7 @@ suspend fun BC.onCommonChatMemberUnsubscribed( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onCommonChatMemberGotPromoted( +fun BC.onCommonChatMemberGotPromoted( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -658,7 +658,7 @@ suspend fun BC.onCommonChatMemberGotPromoted( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onCommonChatMemberGotPromotionChanged( +fun BC.onCommonChatMemberGotPromotionChanged( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -685,7 +685,7 @@ suspend fun BC.onCommonChatMemberGotPromotionChanged( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onCommonChatMemberGotDemoted( +fun BC.onCommonChatMemberGotDemoted( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -712,7 +712,7 @@ suspend fun BC.onCommonChatMemberGotDemoted( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onCommonChatMemberBecameOwner( +fun BC.onCommonChatMemberBecameOwner( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -739,7 +739,7 @@ suspend fun BC.onCommonChatMemberBecameOwner( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onCommonChatMemberCeasedOwnership( +fun BC.onCommonChatMemberCeasedOwnership( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -766,7 +766,7 @@ suspend fun BC.onCommonChatMemberCeasedOwnership( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onCommonChatMemberGotRestricted( +fun BC.onCommonChatMemberGotRestricted( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -793,7 +793,7 @@ suspend fun BC.onCommonChatMemberGotRestricted( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onCommonChatMemberGotRestrictionChanged( +fun BC.onCommonChatMemberGotRestrictionChanged( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -820,7 +820,7 @@ suspend fun BC.onCommonChatMemberGotRestrictionChanged( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onCommonChatMemberGotUnrestricted( +fun BC.onCommonChatMemberGotUnrestricted( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -847,7 +847,7 @@ suspend fun BC.onCommonChatMemberGotUnrestricted( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onCommonChatMemberKicked( +fun BC.onCommonChatMemberKicked( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -874,7 +874,7 @@ suspend fun BC.onCommonChatMemberKicked( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMyChatMemberJoined( +fun BC.onMyChatMemberJoined( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -901,7 +901,7 @@ suspend fun BC.onMyChatMemberJoined( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMyChatMemberLeft( +fun BC.onMyChatMemberLeft( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -928,7 +928,7 @@ suspend fun BC.onMyChatMemberLeft( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMyChatMemberSubscribed( +fun BC.onMyChatMemberSubscribed( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -955,7 +955,7 @@ suspend fun BC.onMyChatMemberSubscribed( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMyChatMemberSubscriptionChanged( +fun BC.onMyChatMemberSubscriptionChanged( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -982,7 +982,7 @@ suspend fun BC.onMyChatMemberSubscriptionChanged( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMyChatMemberUnsubscribed( +fun BC.onMyChatMemberUnsubscribed( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -1009,7 +1009,7 @@ suspend fun BC.onMyChatMemberUnsubscribed( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMyChatMemberGotPromoted( +fun BC.onMyChatMemberGotPromoted( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -1036,7 +1036,7 @@ suspend fun BC.onMyChatMemberGotPromoted( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMyChatMemberGotPromotionChanged( +fun BC.onMyChatMemberGotPromotionChanged( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -1063,7 +1063,7 @@ suspend fun BC.onMyChatMemberGotPromotionChanged( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMyChatMemberGotDemoted( +fun BC.onMyChatMemberGotDemoted( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -1090,7 +1090,7 @@ suspend fun BC.onMyChatMemberGotDemoted( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMyChatMemberBecameOwner( +fun BC.onMyChatMemberBecameOwner( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -1117,7 +1117,7 @@ suspend fun BC.onMyChatMemberBecameOwner( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMyChatMemberCeasedOwnership( +fun BC.onMyChatMemberCeasedOwnership( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -1144,7 +1144,7 @@ suspend fun BC.onMyChatMemberCeasedOwnership( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMyChatMemberGotRestricted( +fun BC.onMyChatMemberGotRestricted( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -1171,7 +1171,7 @@ suspend fun BC.onMyChatMemberGotRestricted( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMyChatMemberGotRestrictionChanged( +fun BC.onMyChatMemberGotRestrictionChanged( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -1198,7 +1198,7 @@ suspend fun BC.onMyChatMemberGotRestrictionChanged( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMyChatMemberGotUnrestricted( +fun BC.onMyChatMemberGotUnrestricted( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, @@ -1225,7 +1225,7 @@ suspend fun BC.onMyChatMemberGotUnrestricted( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMyChatMemberKicked( +fun BC.onMyChatMemberKicked( initialFilter: SimpleFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, markerFactory: MarkerFactory? = ByChatChatMemberUpdatedMarkerFactory, 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 baa3984c9d..8479e63e5f 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 @@ -2,6 +2,8 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling +import dev.inmo.kslog.common.KSLog +import dev.inmo.micro_utils.coroutines.launchLoggingDropExceptions import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions import dev.inmo.micro_utils.coroutines.runCatchingSafely import dev.inmo.tgbotapi.extensions.behaviour_builder.* @@ -19,6 +21,7 @@ import dev.inmo.tgbotapi.types.message.content.TextContent import dev.inmo.tgbotapi.types.message.content.TextMessage import dev.inmo.tgbotapi.types.update.abstracts.Update import kotlinx.coroutines.Job +import kotlinx.coroutines.job internal fun BC.commandUncounted( commandRegex: Regex, @@ -49,7 +52,7 @@ internal fun BC.commandUncounted( scenarioReceiver ) -suspend fun BC.command( +fun BC.command( commandRegex: Regex, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, @@ -57,35 +60,37 @@ suspend fun BC.command( markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver? = null, scenarioReceiver: CustomBehaviourContextAndTypeReceiver -): Job = runCatching { - commandUncounted( - commandRegex, - requireOnlyCommandInMessage, - initialFilter, - subcontextUpdatesFilter, - markerFactory, - additionalSubcontextInitialAction, - scenarioReceiver - ) -}.onFailure { - triggersHolder.handleableCommandsHolder.unregisterHandleable(commandRegex) -}.onSuccess { - triggersHolder.handleableCommandsHolder.registerHandleable(commandRegex) - it.invokeOnCompletion { - runCatching { - launchSafelyWithoutExceptions { - triggersHolder.handleableCommandsHolder.unregisterHandleable(commandRegex) +): Job = launchInNewSubContext { + runCatching { + this@launchInNewSubContext.commandUncounted( + commandRegex, + requireOnlyCommandInMessage, + initialFilter, + subcontextUpdatesFilter, + markerFactory, + additionalSubcontextInitialAction, + scenarioReceiver + ) + }.onFailure { + triggersHolder.handleableCommandsHolder.unregisterHandleable(commandRegex) + }.onSuccess { + triggersHolder.handleableCommandsHolder.registerHandleable(commandRegex) + it.invokeOnCompletion { + runCatching { + launchSafelyWithoutExceptions { + triggersHolder.handleableCommandsHolder.unregisterHandleable(commandRegex) + } } } - } -}.getOrThrow() + }.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( +fun BC.command( command: String, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, @@ -100,7 +105,7 @@ suspend fun BC.command( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.command( +fun BC.command( botCommand: BotCommand, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, @@ -115,7 +120,7 @@ suspend fun BC.command( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onCommand( +fun BC.onCommand( commandRegex: Regex, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, @@ -130,7 +135,7 @@ suspend fun BC.onCommand( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onCommand( +fun BC.onCommand( command: String, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, @@ -145,7 +150,7 @@ suspend fun BC.onCommand( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onCommand( +fun BC.onCommand( botCommand: BotCommand, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, @@ -160,7 +165,7 @@ suspend fun BC.onCommand( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.commandWithArgs( +fun BC.commandWithArgs( commandRegex: Regex, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, @@ -187,7 +192,7 @@ suspend fun BC.commandWithArgs( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.commandWithArgs( +fun BC.commandWithArgs( command: String, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, @@ -209,7 +214,7 @@ suspend fun BC.commandWithArgs( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.commandWithArgs( +fun BC.commandWithArgs( botCommand: BotCommand, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, @@ -231,7 +236,7 @@ suspend fun BC.commandWithArgs( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.commandWithNamedArgs( +fun BC.commandWithNamedArgs( commandRegex: Regex, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, @@ -259,7 +264,7 @@ suspend fun BC.commandWithNamedArgs( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.commandWithNamedArgs( +fun BC.commandWithNamedArgs( command: String, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, @@ -283,7 +288,7 @@ suspend fun BC.commandWithNamedArgs( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.commandWithNamedArgs( +fun BC.commandWithNamedArgs( botCommand: BotCommand, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, @@ -307,7 +312,7 @@ suspend fun BC.commandWithNamedArgs( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onCommandWithArgs( +fun BC.onCommandWithArgs( commandRegex: Regex, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, @@ -329,7 +334,7 @@ suspend fun BC.onCommandWithArgs( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onCommandWithArgs( +fun BC.onCommandWithArgs( command: String, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, @@ -351,7 +356,7 @@ suspend fun BC.onCommandWithArgs( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onCommandWithArgs( +fun BC.onCommandWithArgs( botCommand: BotCommand, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, @@ -373,7 +378,7 @@ suspend fun BC.onCommandWithArgs( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onCommandWithNamedArgs( +fun BC.onCommandWithNamedArgs( commandRegex: Regex, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, @@ -397,7 +402,7 @@ suspend fun BC.onCommandWithNamedArgs( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onCommandWithNamedArgs( +fun BC.onCommandWithNamedArgs( command: String, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, @@ -421,7 +426,7 @@ suspend fun BC.onCommandWithNamedArgs( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onCommandWithNamedArgs( +fun BC.onCommandWithNamedArgs( botCommand: BotCommand, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, 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 0a7d396d0f..f40bea4e7d 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 @@ -319,7 +319,7 @@ fun BC.onStory( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onTextedContent( +fun BC.onTextedContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -346,7 +346,7 @@ suspend fun BC.onTextedContent( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onVenue( +fun BC.onVenue( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -373,7 +373,7 @@ suspend fun BC.onVenue( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onAudioMediaGroup( +fun BC.onAudioMediaGroup( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -400,7 +400,7 @@ suspend fun BC.onAudioMediaGroup( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onDocumentMediaGroupContent( +fun BC.onDocumentMediaGroupContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -427,7 +427,7 @@ suspend fun BC.onDocumentMediaGroupContent( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onTextedMediaContent( +fun BC.onTextedMediaContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -454,7 +454,7 @@ suspend fun BC.onTextedMediaContent( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMediaCollection( +fun BC.onMediaCollection( initialFilter: CommonMessageFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -481,7 +481,7 @@ suspend fun BC.onMediaCollection( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMedia( +fun BC.onMedia( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -508,7 +508,7 @@ suspend fun BC.onMedia( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onAnimation( +fun BC.onAnimation( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -535,7 +535,7 @@ suspend fun BC.onAnimation( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onAudio( +fun BC.onAudio( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -562,7 +562,7 @@ suspend fun BC.onAudio( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onDocument( +fun BC.onDocument( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -589,7 +589,7 @@ suspend fun BC.onDocument( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onPhoto( +fun BC.onPhoto( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -616,7 +616,7 @@ suspend fun BC.onPhoto( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onSticker( +fun BC.onSticker( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -643,7 +643,7 @@ suspend fun BC.onSticker( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onVideo( +fun BC.onVideo( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -670,7 +670,7 @@ suspend fun BC.onVideo( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onVideoNote( +fun BC.onVideoNote( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -697,7 +697,7 @@ suspend fun BC.onVideoNote( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onVoice( +fun BC.onVoice( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -724,7 +724,7 @@ suspend fun BC.onVoice( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onInvoice( +fun BC.onInvoice( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -751,7 +751,7 @@ suspend fun BC.onInvoice( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onVisualContent( +fun BC.onVisualContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -778,7 +778,7 @@ suspend fun BC.onVisualContent( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onMediaContent( +fun BC.onMediaContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -805,7 +805,7 @@ suspend fun BC.onMediaContent( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onGiveawayContent( +fun BC.onGiveawayContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -833,7 +833,7 @@ suspend fun BC.onGiveawayContent( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onGiveawayPublicResultsContent( +fun BC.onGiveawayPublicResultsContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -862,7 +862,7 @@ suspend fun BC.onGiveawayPublicResultsContent( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onGiveawayWinners( +fun BC.onGiveawayWinners( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -886,7 +886,7 @@ suspend fun BC.onGiveawayWinners( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onPaidMediaInfoContent( +fun BC.onPaidMediaInfoContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, 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 6911838256..b9e80bc2e4 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 @@ -19,30 +19,32 @@ import io.ktor.http.decodeURLQueryComponent import kotlinx.coroutines.Job private val startRegex = Regex("start") -suspend fun BC.onDeepLink( +fun BC.onDeepLink( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = { (message, _), update -> MessageFilterByChat(this, message, update) }, markerFactory: MarkerFactory, Any>? = MarkerFactory { (message, _) -> ByChatMessageMarkerFactory(message) }, additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver>? = null, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> -): Job = on( - markerFactory, - SimpleFilter> { (message, _) -> - message.content.textSources.size == 2 - && message.content.textSources.firstOrNull() ?.asBotCommandTextSource() ?.command == "start" - && message.content.textSources.getOrNull(1) is RegularTextSource - } * initialFilter, - subcontextUpdatesFilter, - additionalSubcontextInitialAction, - scenarioReceiver, -) { - (it.messageUpdateOrNull()) ?.data ?.commonMessageOrNull() ?.withContentOrNull() ?.let { message -> - message to (message.content.textSources.getOrNull(1) ?.source ?.removePrefix(" ") ?.decodeURLQueryComponent() ?: return@let null) - } ?.let(::listOfNotNull) -}.also { - triggersHolder.handleableCommandsHolder.registerHandleable(startRegex) - it.invokeOnCompletion { - this@onDeepLink.launchSafelyWithoutExceptions { triggersHolder.handleableCommandsHolder.unregisterHandleable(startRegex) } +): Job = launchInNewSubContext { + on( + markerFactory, + SimpleFilter> { (message, _) -> + message.content.textSources.size == 2 + && message.content.textSources.firstOrNull() ?.asBotCommandTextSource() ?.command == "start" + && message.content.textSources.getOrNull(1) is RegularTextSource + } * initialFilter, + subcontextUpdatesFilter, + additionalSubcontextInitialAction, + scenarioReceiver, + ) { + (it.messageUpdateOrNull()) ?.data ?.commonMessageOrNull() ?.withContentOrNull() ?.let { message -> + message to (message.content.textSources.getOrNull(1) ?.source ?.removePrefix(" ") ?.decodeURLQueryComponent() ?: return@let null) + } ?.let(::listOfNotNull) + }.also { + triggersHolder.handleableCommandsHolder.registerHandleable(startRegex) + it.invokeOnCompletion { + this@onDeepLink.launchSafelyWithoutExceptions { triggersHolder.handleableCommandsHolder.unregisterHandleable(startRegex) } + } } } @@ -51,7 +53,7 @@ suspend fun BC.onDeepLink( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onDeepLink( +fun BC.onDeepLink( regex: Regex, initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = { (message, _), update -> MessageFilterByChat(this, message, update) }, @@ -70,7 +72,7 @@ suspend fun BC.onDeepLink( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onDeepLink( +fun BC.onDeepLink( deepLink: String, initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = { (message, _), update -> MessageFilterByChat(this, message, update) }, 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 277cf2b374..9321510cae 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 @@ -281,7 +281,7 @@ fun BC.onEditedDocumentMediaGroupContent( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onEditedTextedMediaContent( +fun BC.onEditedTextedMediaContent( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -308,7 +308,7 @@ suspend fun BC.onEditedTextedMediaContent( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onEditedMediaCollection( +fun BC.onEditedMediaCollection( initialFilter: CommonMessageFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -335,7 +335,7 @@ suspend fun BC.onEditedMediaCollection( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onEditedMedia( +fun BC.onEditedMedia( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -362,7 +362,7 @@ suspend fun BC.onEditedMedia( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onEditedAnimation( +fun BC.onEditedAnimation( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -389,7 +389,7 @@ suspend fun BC.onEditedAnimation( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onEditedAudio( +fun BC.onEditedAudio( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -416,7 +416,7 @@ suspend fun BC.onEditedAudio( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onEditedDocument( +fun BC.onEditedDocument( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -443,7 +443,7 @@ suspend fun BC.onEditedDocument( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onEditedPhoto( +fun BC.onEditedPhoto( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -470,7 +470,7 @@ suspend fun BC.onEditedPhoto( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onEditedSticker( +fun BC.onEditedSticker( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -497,7 +497,7 @@ suspend fun BC.onEditedSticker( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onEditedVideo( +fun BC.onEditedVideo( initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -524,7 +524,7 @@ suspend fun BC.onEditedVideo( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onEditedVideoNote( +fun BC.onEditedVideoNote( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -551,7 +551,7 @@ suspend fun BC.onEditedVideoNote( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onEditedVoice( +fun BC.onEditedVoice( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, @@ -578,7 +578,7 @@ suspend fun BC.onEditedVoice( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onEditedInvoice( +fun BC.onEditedInvoice( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory? = ByChatMessageMarkerFactory, 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 7f704039a7..30ada1eeeb 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 @@ -238,7 +238,7 @@ fun BC.onMessageAutoDeleteTimerChangedEvent( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onPublicChatEvent( +fun BC.onPublicChatEvent( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -259,7 +259,7 @@ suspend fun BC.onPublicChatEvent( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onCommonEvent( +fun BC.onCommonEvent( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -280,7 +280,7 @@ suspend fun BC.onCommonEvent( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onGroupEvent( +fun BC.onGroupEvent( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -301,7 +301,7 @@ suspend fun BC.onGroupEvent( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onSupergroupEvent( +fun BC.onSupergroupEvent( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -322,7 +322,7 @@ suspend fun BC.onSupergroupEvent( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onChannelChatCreated( +fun BC.onChannelChatCreated( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -343,7 +343,7 @@ suspend fun BC.onChannelChatCreated( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onDeleteChatPhoto( +fun BC.onDeleteChatPhoto( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -364,7 +364,7 @@ suspend fun BC.onDeleteChatPhoto( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onGroupChatCreated( +fun BC.onGroupChatCreated( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -385,7 +385,7 @@ suspend fun BC.onGroupChatCreated( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onLeftChatMember( +fun BC.onLeftChatMember( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -406,7 +406,7 @@ suspend fun BC.onLeftChatMember( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onNewChatMembers( +fun BC.onNewChatMembers( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -427,7 +427,7 @@ suspend fun BC.onNewChatMembers( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onNewChatPhoto( +fun BC.onNewChatPhoto( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -448,7 +448,7 @@ suspend fun BC.onNewChatPhoto( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onNewChatTitle( +fun BC.onNewChatTitle( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -469,7 +469,7 @@ suspend fun BC.onNewChatTitle( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onPinnedMessage( +fun BC.onPinnedMessage( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -490,7 +490,7 @@ suspend fun BC.onPinnedMessage( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onProximityAlertTriggered( +fun BC.onProximityAlertTriggered( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -511,7 +511,7 @@ suspend fun BC.onProximityAlertTriggered( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onSupergroupChatCreated( +fun BC.onSupergroupChatCreated( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -535,7 +535,7 @@ suspend fun BC.onSupergroupChatCreated( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onSuccessfulPayment( +fun BC.onSuccessfulPayment( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -556,7 +556,7 @@ suspend fun BC.onSuccessfulPayment( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onRefundedPayment( +fun BC.onRefundedPayment( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -577,7 +577,7 @@ suspend fun BC.onRefundedPayment( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onUserLoggedIn( +fun BC.onUserLoggedIn( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -598,7 +598,7 @@ suspend fun BC.onUserLoggedIn( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onWebAppData( +fun BC.onWebAppData( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -619,7 +619,7 @@ suspend fun BC.onWebAppData( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onForumTopicClosed( +fun BC.onForumTopicClosed( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -640,7 +640,7 @@ suspend fun BC.onForumTopicClosed( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onForumTopicCreated( +fun BC.onForumTopicCreated( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -661,7 +661,7 @@ suspend fun BC.onForumTopicCreated( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onForumTopicReopened( +fun BC.onForumTopicReopened( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -683,7 +683,7 @@ suspend fun BC.onForumTopicReopened( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onForumTopicEdited( +fun BC.onForumTopicEdited( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -704,7 +704,7 @@ suspend fun BC.onForumTopicEdited( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onGeneralForumTopicHidden( +fun BC.onGeneralForumTopicHidden( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -725,7 +725,7 @@ suspend fun BC.onGeneralForumTopicHidden( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onGeneralForumTopicUnhidden( +fun BC.onGeneralForumTopicUnhidden( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -747,7 +747,7 @@ suspend fun BC.onGeneralForumTopicUnhidden( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onWriteAccessAllowed( +fun BC.onWriteAccessAllowed( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -769,7 +769,7 @@ suspend fun BC.onWriteAccessAllowed( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onWriteAccessAllowedFromRequest( +fun BC.onWriteAccessAllowedFromRequest( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -791,7 +791,7 @@ suspend fun BC.onWriteAccessAllowedFromRequest( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onWriteAccessAllowedFromAttachmentMenu( +fun BC.onWriteAccessAllowedFromAttachmentMenu( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -813,7 +813,7 @@ suspend fun BC.onWriteAccessAllowedFromAttachmentMenu( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onWriteAccessAllowedOther( +fun BC.onWriteAccessAllowedOther( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -835,7 +835,7 @@ suspend fun BC.onWriteAccessAllowedOther( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onWriteAccessAllowedFromWebAppLink( +fun BC.onWriteAccessAllowedFromWebAppLink( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -858,7 +858,7 @@ suspend fun BC.onWriteAccessAllowedFromWebAppLink( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onChatSharedRequest( +fun BC.onChatSharedRequest( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -880,7 +880,7 @@ suspend fun BC.onChatSharedRequest( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onUsersShared( +fun BC.onUsersShared( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -902,7 +902,7 @@ suspend fun BC.onUsersShared( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onUserShared( +fun BC.onUserShared( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -925,7 +925,7 @@ suspend fun BC.onUserShared( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onChatShared( +fun BC.onChatShared( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -948,7 +948,7 @@ suspend fun BC.onChatShared( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onChatBoostAdded( +fun BC.onChatBoostAdded( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -970,7 +970,7 @@ suspend fun BC.onChatBoostAdded( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onChatBackgroundSet( +fun BC.onChatBackgroundSet( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -992,7 +992,7 @@ suspend fun BC.onChatBackgroundSet( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onGiveawayCreated( +fun BC.onGiveawayCreated( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -1015,7 +1015,7 @@ suspend fun BC.onGiveawayCreated( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onGiveawayCompleted( +fun BC.onGiveawayCompleted( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -1039,7 +1039,7 @@ suspend fun BC.onGiveawayCompleted( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onGiveawayCompletedWithPrivateWinners( +fun BC.onGiveawayCompletedWithPrivateWinners( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -1061,7 +1061,7 @@ suspend fun BC.onGiveawayCompletedWithPrivateWinners( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onPaidMessagePriceChanged( +fun BC.onPaidMessagePriceChanged( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -1083,7 +1083,7 @@ suspend fun BC.onPaidMessagePriceChanged( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onRegularGiftSentOrReceived( +fun BC.onRegularGiftSentOrReceived( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, @@ -1105,7 +1105,7 @@ suspend fun BC.onRegularGiftSentOrReceived( * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ -suspend fun BC.onUniqueGiftSentOrReceived( +fun BC.onUniqueGiftSentOrReceived( initialFilter: SimpleFilter>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any>? = ByChatMessageMarkerFactory, 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 364e2c876b..2370d1fe70 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 @@ -214,7 +214,7 @@ fun BC.onMentionWithMediaGroupContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onMentionWithMediaGroupPartContent( +fun BC.onMentionWithMediaGroupPartContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -228,7 +228,7 @@ suspend fun BC.onMentionWithMediaGroupPartContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onTextMentionWithMediaGroupPartContent( +fun BC.onTextMentionWithMediaGroupPartContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -242,7 +242,7 @@ suspend fun BC.onTextMentionWithMediaGroupPartContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onMentionWithMediaGroupPartContent( +fun BC.onMentionWithMediaGroupPartContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -258,7 +258,7 @@ suspend fun BC.onMentionWithMediaGroupPartContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onMentionWithAudioContent( +fun BC.onMentionWithAudioContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -272,7 +272,7 @@ suspend fun BC.onMentionWithAudioContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onTextMentionWithAudioContent( +fun BC.onTextMentionWithAudioContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -286,7 +286,7 @@ suspend fun BC.onTextMentionWithAudioContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onMentionWithAudioContent( +fun BC.onMentionWithAudioContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -302,7 +302,7 @@ suspend fun BC.onMentionWithAudioContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onMentionWithDocumentContent( +fun BC.onMentionWithDocumentContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -316,7 +316,7 @@ suspend fun BC.onMentionWithDocumentContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onTextMentionWithDocumentContent( +fun BC.onTextMentionWithDocumentContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -330,7 +330,7 @@ suspend fun BC.onTextMentionWithDocumentContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onMentionWithDocumentContent( +fun BC.onMentionWithDocumentContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -346,7 +346,7 @@ suspend fun BC.onMentionWithDocumentContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onMentionWithVisualMediaGroupPartContent( +fun BC.onMentionWithVisualMediaGroupPartContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -360,7 +360,7 @@ suspend fun BC.onMentionWithVisualMediaGroupPartContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onTextMentionWithVisualMediaGroupPartContent( +fun BC.onTextMentionWithVisualMediaGroupPartContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -374,7 +374,7 @@ suspend fun BC.onTextMentionWithVisualMediaGroupPartCont * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onMentionWithVisualMediaGroupPartContent( +fun BC.onMentionWithVisualMediaGroupPartContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -390,7 +390,7 @@ suspend fun BC.onMentionWithVisualMediaGroupPartContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onMentionWithVideoContent( +fun BC.onMentionWithVideoContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -404,7 +404,7 @@ suspend fun BC.onMentionWithVideoContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onTextMentionWithVideoContent( +fun BC.onTextMentionWithVideoContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -418,7 +418,7 @@ suspend fun BC.onTextMentionWithVideoContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onMentionWithVideoContent( +fun BC.onMentionWithVideoContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -434,7 +434,7 @@ suspend fun BC.onMentionWithVideoContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onMentionWithPhotoContent( +fun BC.onMentionWithPhotoContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -448,7 +448,7 @@ suspend fun BC.onMentionWithPhotoContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onTextMentionWithPhotoContent( +fun BC.onTextMentionWithPhotoContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -462,7 +462,7 @@ suspend fun BC.onTextMentionWithPhotoContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onMentionWithPhotoContent( +fun BC.onMentionWithPhotoContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -478,7 +478,7 @@ suspend fun BC.onMentionWithPhotoContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onMentionWithAnimationContent( +fun BC.onMentionWithAnimationContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -492,7 +492,7 @@ suspend fun BC.onMentionWithAnimationContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onTextMentionWithAnimationContent( +fun BC.onTextMentionWithAnimationContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -506,7 +506,7 @@ suspend fun BC.onTextMentionWithAnimationContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onMentionWithAnimationContent( +fun BC.onMentionWithAnimationContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -522,7 +522,7 @@ suspend fun BC.onMentionWithAnimationContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onMentionWithTextContent( +fun BC.onMentionWithTextContent( username: Username, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -536,7 +536,7 @@ suspend fun BC.onMentionWithTextContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onTextMentionWithTextContent( +fun BC.onTextMentionWithTextContent( userId: UserId, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null, @@ -550,7 +550,7 @@ suspend fun BC.onTextMentionWithTextContent( * [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for * "stream" */ -suspend fun BC.onMentionWithTextContent( +fun BC.onMentionWithTextContent( user: User, initialFilter: CommonMessageFilter? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = null,