From 0441b53da22189de8bd1cbdbaf83869a8432c0c2 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 1 Jul 2023 03:46:29 +0600 Subject: [PATCH] all query triggers got null default subcontext filter --- CHANGELOG.md | 2 + .../CallbackQueryTriggers.kt | 35 ++++++------ .../CallbackQueryTriggersUnhandled.kt | 7 ++- .../ChatMemberUpdatedTriggers.kt | 9 ++-- .../triggers_handling/CommandHandling.kt | 26 ++++----- .../CommandHandlingUnhandled.kt | 8 +-- .../triggers_handling/ContentTriggers.kt | 54 +++++++++---------- .../triggers_handling/DeepLinkHandling.kt | 6 +-- .../EditedContentTriggers.kt | 42 +++++++-------- .../triggers_handling/InlineQueryTriggers.kt | 15 +++--- 10 files changed, 101 insertions(+), 103 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1b2da0212..66700099ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ * Now it is possible to get raw updates with `GetUpdatesRaw` request * `Utils`: * Improve extension `Update.sourceChat` to add opportunity to select some chats by logic different with the default +* `BehaviourBuilder`: + * All query triggers got null default subcontext filter ## 8.1.0 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..295ca7d02c 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 @@ -5,7 +5,6 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions import dev.inmo.micro_utils.coroutines.runCatchingSafely import dev.inmo.tgbotapi.extensions.behaviour_builder.* -import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.CallbackQueryFilterByUser import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByUserCallbackQueryMarkerFactory import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory @@ -17,7 +16,7 @@ import kotlinx.coroutines.Job internal suspend inline fun BC.onCallbackQuery( initialFilter: SimpleFilter? = null, - noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { @@ -38,7 +37,7 @@ internal suspend inline fun B */ internal suspend inline fun BC.onDataCallbackQueryCounted( initialFilter: SimpleFilter? = null, - noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver ): Job { @@ -80,7 +79,7 @@ internal suspend inline fun BC.onDataCallbackQuery( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onDataCallbackQueryCounted( @@ -107,7 +106,7 @@ suspend fun BC.onDataCallbackQuery( suspend fun BC.onDataCallbackQuery( dataRegex: Regex, initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onDataCallbackQuery( @@ -135,7 +134,7 @@ suspend fun BC.onDataCallbackQuery( suspend fun BC.onDataCallbackQuery( data: String, initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onDataCallbackQuery( @@ -160,7 +159,7 @@ suspend fun BC.onDataCallbackQuery( */ suspend fun BC.onGameShortNameCallbackQuery( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery( @@ -184,7 +183,7 @@ suspend fun BC.onGameShortNameCallbackQuery( */ suspend fun BC.onInlineMessageIdCallbackQuery( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery( @@ -208,7 +207,7 @@ suspend fun BC.onInlineMessageIdCallbackQuery( */ suspend fun BC.onInlineMessageIdDataCallbackQuery( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onDataCallbackQueryCounted( @@ -235,7 +234,7 @@ suspend fun BC.onInlineMessageIdDataCallbackQuery( suspend fun BC.onInlineMessageIdDataCallbackQuery( dataRegex: Regex, initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onInlineMessageIdDataCallbackQuery( @@ -263,7 +262,7 @@ suspend fun BC.onInlineMessageIdDataCallbackQuery( suspend fun BC.onInlineMessageIdDataCallbackQuery( data: String, initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onInlineMessageIdDataCallbackQuery( @@ -288,7 +287,7 @@ suspend fun BC.onInlineMessageIdDataCallbackQuery( */ suspend fun BC.onInlineMessageIdGameShortNameCallbackQuery( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery( @@ -312,7 +311,7 @@ suspend fun BC.onInlineMessageIdGameShortNameCallbackQue */ suspend fun BC.onMessageCallbackQuery( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery( @@ -336,7 +335,7 @@ suspend fun BC.onMessageCallbackQuery( */ suspend fun BC.onMessageDataCallbackQuery( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onDataCallbackQueryCounted( @@ -363,7 +362,7 @@ suspend fun BC.onMessageDataCallbackQuery( suspend fun BC.onMessageDataCallbackQuery( dataRegex: Regex, initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onMessageDataCallbackQuery( @@ -391,7 +390,7 @@ suspend fun BC.onMessageDataCallbackQuery( suspend fun BC.onMessageDataCallbackQuery( data: String, initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onMessageDataCallbackQuery( @@ -416,7 +415,7 @@ suspend fun BC.onMessageDataCallbackQuery( */ suspend fun BC.onMessageGameShortNameCallbackQuery( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery( @@ -440,7 +439,7 @@ suspend fun BC.onMessageGameShortNameCallbackQuery( */ suspend fun BC.onUnknownCallbackQueryType( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery( 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 ef0c85a334..95889f052c 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 @@ -3,7 +3,6 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling import dev.inmo.tgbotapi.extensions.behaviour_builder.* -import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.CallbackQueryFilterByUser import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.* import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByUserCallbackQueryMarkerFactory import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory @@ -26,7 +25,7 @@ import dev.inmo.tgbotapi.utils.PreviewFeature @PreviewFeature suspend fun BC.onUnhandledDataCallbackQuery( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery ( @@ -51,7 +50,7 @@ suspend fun BC.onUnhandledDataCallbackQuery( @PreviewFeature suspend fun BC.onUnhandledInlineMessageIdDataCallbackQuery( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery ( @@ -76,7 +75,7 @@ suspend fun BC.onUnhandledInlineMessageIdDataCallbackQue @PreviewFeature suspend fun BC.onUnhandledMessageDataCallbackQuery( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = CallbackQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserCallbackQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onCallbackQuery( 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 c6954be2d2..349f168a6c 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 @@ -3,7 +3,6 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling import dev.inmo.tgbotapi.extensions.behaviour_builder.* -import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.ChatMemberUpdatedFilterByChat import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByChatChatMemberUpdatedMarkerFactory import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory @@ -15,7 +14,7 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update internal suspend inline fun BC.onChatMemberUpdatedInternal( initialFilter: SimpleFilter? = null, - noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, + noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByChatChatMemberUpdatedMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { @@ -37,7 +36,7 @@ internal suspend inline fun BC.onChatMemberUpdated( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByChatChatMemberUpdatedMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onChatMemberUpdatedInternal( @@ -61,7 +60,7 @@ suspend fun BC.onChatMemberUpdated( */ suspend fun BC.onCommonChatMemberUpdated( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByChatChatMemberUpdatedMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onChatMemberUpdatedInternal( @@ -85,7 +84,7 @@ suspend fun BC.onCommonChatMemberUpdated( */ suspend fun BC.onMyChatMemberUpdated( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = ChatMemberUpdatedFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByChatChatMemberUpdatedMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onChatMemberUpdatedInternal( 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 3802ee5dc1..ebfa9d0cb3 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 @@ -22,7 +22,7 @@ internal suspend fun BC.commandUncounted( commandRegex: Regex, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ): Job = onText( @@ -49,7 +49,7 @@ suspend fun BC.command( commandRegex: Regex, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ): Job = runCatchingSafely { @@ -78,7 +78,7 @@ suspend fun BC.command( command: String, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = command(command.toRegex(), requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -87,7 +87,7 @@ suspend fun BC.command( botCommand: BotCommand, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = command(botCommand.command, requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -96,7 +96,7 @@ suspend fun BC.onCommand( commandRegex: Regex, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ): Job = command(commandRegex, requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -105,7 +105,7 @@ suspend fun BC.onCommand( command: String, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ): Job = onCommand(command.toRegex(), requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -114,7 +114,7 @@ suspend fun BC.onCommand( botCommand: BotCommand, requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ): Job = onCommand(botCommand.command, requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -122,7 +122,7 @@ suspend fun BC.onCommand( suspend fun BC.commandWithArgs( commandRegex: Regex, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver> ) = command( @@ -142,7 +142,7 @@ suspend fun BC.commandWithArgs( suspend fun BC.commandWithArgs( command: String, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver> ) = commandWithArgs( @@ -156,7 +156,7 @@ suspend fun BC.commandWithArgs( suspend fun BC.commandWithArgs( botCommand: BotCommand, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver> ) = commandWithArgs( @@ -170,7 +170,7 @@ suspend fun BC.commandWithArgs( suspend fun BC.onCommandWithArgs( commandRegex: Regex, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver> ): Job = commandWithArgs(commandRegex, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -178,7 +178,7 @@ suspend fun BC.onCommandWithArgs( suspend fun BC.onCommandWithArgs( command: String, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver> ): Job = onCommandWithArgs(command.toRegex(), initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -186,7 +186,7 @@ suspend fun BC.onCommandWithArgs( suspend fun BC.onCommandWithArgs( botCommand: BotCommand, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver> ): Job = onCommandWithArgs(botCommand.command, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) 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 0219490400..4ec378cb27 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 @@ -20,7 +20,7 @@ import kotlinx.coroutines.Job suspend fun BC.unhandledCommand( requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ): Job = onText( @@ -48,7 +48,7 @@ suspend fun BC.unhandledCommand( suspend fun BC.onUnhandledCommand( requireOnlyCommandInMessage: Boolean = true, initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ): Job = unhandledCommand(requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -56,7 +56,7 @@ suspend fun BC.onUnhandledCommand( @PreviewFeature suspend fun BC.unhandledCommandWithArgs( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver>> ) = onUnhandledCommand( @@ -74,7 +74,7 @@ suspend fun BC.unhandledCommandWithArgs( @PreviewFeature suspend fun BC.onUnhandledCommandWithArgs( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, 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 2ff230af77..80901c26bf 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 @@ -46,7 +46,7 @@ internal suspend inline fun */ suspend fun BC.onContentMessage( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update> = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onContentMessageWithType( @@ -70,7 +70,7 @@ suspend fun BC.onContentMessage( */ suspend fun BC.onContact( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -94,7 +94,7 @@ suspend fun BC.onContact( */ suspend fun BC.onDice( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -118,7 +118,7 @@ suspend fun BC.onDice( */ suspend fun BC.onGame( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -142,7 +142,7 @@ suspend fun BC.onGame( */ suspend fun BC.onLocation( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -166,7 +166,7 @@ suspend fun BC.onLocation( */ suspend fun BC.onLiveLocation( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -190,7 +190,7 @@ suspend fun BC.onLiveLocation( */ suspend fun BC.onStaticLocation( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -214,7 +214,7 @@ suspend fun BC.onStaticLocation( */ suspend fun BC.onPoll( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -238,7 +238,7 @@ suspend fun BC.onPoll( */ suspend fun BC.onText( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -262,7 +262,7 @@ suspend fun BC.onText( */ suspend fun BC.onTextedContent( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -286,7 +286,7 @@ suspend fun BC.onTextedContent( */ suspend fun BC.onVenue( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -310,7 +310,7 @@ suspend fun BC.onVenue( */ suspend fun BC.onAudioMediaGroup( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -334,7 +334,7 @@ suspend fun BC.onAudioMediaGroup( */ suspend fun BC.onDocumentMediaGroupContent( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -358,7 +358,7 @@ suspend fun BC.onDocumentMediaGroupContent( */ suspend fun BC.onTextedMediaContent( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -382,7 +382,7 @@ suspend fun BC.onTextedMediaContent( */ suspend fun BC.onMediaCollection( initialFilter: CommonMessageFilter>? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update> = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ) = onContentMessageWithType( @@ -406,7 +406,7 @@ suspend fun BC.onMediaCollection( */ suspend fun BC.onMedia( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -430,7 +430,7 @@ suspend fun BC.onMedia( */ suspend fun BC.onAnimation( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -454,7 +454,7 @@ suspend fun BC.onAnimation( */ suspend fun BC.onAudio( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -478,7 +478,7 @@ suspend fun BC.onAudio( */ suspend fun BC.onDocument( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -502,7 +502,7 @@ suspend fun BC.onDocument( */ suspend fun BC.onPhoto( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -526,7 +526,7 @@ suspend fun BC.onPhoto( */ suspend fun BC.onSticker( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -550,7 +550,7 @@ suspend fun BC.onSticker( */ suspend fun BC.onVideo( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -574,7 +574,7 @@ suspend fun BC.onVideo( */ suspend fun BC.onVideoNote( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -598,7 +598,7 @@ suspend fun BC.onVideoNote( */ suspend fun BC.onVoice( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -622,7 +622,7 @@ suspend fun BC.onVoice( */ suspend fun BC.onInvoice( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -646,7 +646,7 @@ suspend fun BC.onInvoice( */ suspend fun BC.onVisualContent( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( @@ -670,7 +670,7 @@ suspend fun BC.onVisualContent( */ suspend fun BC.onMediaContent( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onContentMessageWithType( 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 62e38cda02..9ca2030f10 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 @@ -24,7 +24,7 @@ import kotlinx.coroutines.flow.filter private val startRegex = Regex("start") suspend fun BC.onDeepLink( initialFilter: SimpleFilter>? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update> = { (message, _), update -> MessageFilterByChat(this, message, update) }, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = { (message, _), update -> MessageFilterByChat(this, message, update) }, markerFactory: MarkerFactory, Any> = MarkerFactory { (message, _) -> ByChatMessageMarkerFactory(message) }, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ): Job = on( @@ -50,7 +50,7 @@ suspend fun BC.onDeepLink( suspend fun BC.onDeepLink( regex: Regex, initialFilter: SimpleFilter>? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update> = { (message, _), update -> MessageFilterByChat(this, message, update) }, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = { (message, _), update -> MessageFilterByChat(this, message, update) }, markerFactory: MarkerFactory, Any> = MarkerFactory { (message, _) -> ByChatMessageMarkerFactory(message) }, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> ): Job { @@ -63,7 +63,7 @@ suspend fun BC.onDeepLink( suspend fun BC.onDeepLink( deepLink: String, initialFilter: SimpleFilter>? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update> = { (message, _), update -> MessageFilterByChat(this, message, update) }, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = { (message, _), update -> MessageFilterByChat(this, message, update) }, 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/EditedContentTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EditedContentTriggers.kt index 3141a57439..57912762bd 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 @@ -40,7 +40,7 @@ internal suspend inline fun */ suspend fun BC.onEditedContentMessage( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update> = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> )= onEditedContent( @@ -64,7 +64,7 @@ suspend fun BC.onEditedContentMessage( */ suspend fun BC.onEditedContact( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -88,7 +88,7 @@ suspend fun BC.onEditedContact( */ suspend fun BC.onEditedDice( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -112,7 +112,7 @@ suspend fun BC.onEditedDice( */ suspend fun BC.onEditedGame( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -136,7 +136,7 @@ suspend fun BC.onEditedGame( */ suspend fun BC.onEditedLocation( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -160,7 +160,7 @@ suspend fun BC.onEditedLocation( */ suspend fun BC.onEditedText( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -184,7 +184,7 @@ suspend fun BC.onEditedText( */ suspend fun BC.onEditedVenue( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -208,7 +208,7 @@ suspend fun BC.onEditedVenue( */ suspend fun BC.onEditedAudioMediaGroup( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -232,7 +232,7 @@ suspend fun BC.onEditedAudioMediaGroup( */ suspend fun BC.onEditedDocumentMediaGroupContent( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -256,7 +256,7 @@ suspend fun BC.onEditedDocumentMediaGroupContent( */ suspend fun BC.onEditedTextedMediaContent( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -280,7 +280,7 @@ suspend fun BC.onEditedTextedMediaContent( */ suspend fun BC.onEditedMediaCollection( initialFilter: CommonMessageFilter>? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update> = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update>? = MessageFilterByChat, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver> )= onEditedContent( @@ -304,7 +304,7 @@ suspend fun BC.onEditedMediaCollection( */ suspend fun BC.onEditedMedia( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -328,7 +328,7 @@ suspend fun BC.onEditedMedia( */ suspend fun BC.onEditedAnimation( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -352,7 +352,7 @@ suspend fun BC.onEditedAnimation( */ suspend fun BC.onEditedAudio( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -376,7 +376,7 @@ suspend fun BC.onEditedAudio( */ suspend fun BC.onEditedDocument( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -400,7 +400,7 @@ suspend fun BC.onEditedDocument( */ suspend fun BC.onEditedPhoto( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -424,7 +424,7 @@ suspend fun BC.onEditedPhoto( */ suspend fun BC.onEditedSticker( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -448,7 +448,7 @@ suspend fun BC.onEditedSticker( */ suspend fun BC.onEditedVideo( initialFilter: CommonMessageFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -472,7 +472,7 @@ suspend fun BC.onEditedVideo( */ suspend fun BC.onEditedVideoNote( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -496,7 +496,7 @@ suspend fun BC.onEditedVideoNote( */ suspend fun BC.onEditedVoice( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( @@ -520,7 +520,7 @@ suspend fun BC.onEditedVoice( */ suspend fun BC.onEditedInvoice( initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver = MessageFilterByChat, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = MessageFilterByChat, markerFactory: MarkerFactory = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver )= onEditedContent( 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..432213f547 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 @@ -1,7 +1,6 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling import dev.inmo.tgbotapi.extensions.behaviour_builder.* -import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.InlineQueryFilterByUser import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByUserInlineQueryMarkerFactory import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory @@ -11,7 +10,7 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update internal suspend inline fun BC.onInlineQuery( initialFilter: SimpleFilter? = null, - noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = InlineQueryFilterByUser, + noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserInlineQueryMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { @@ -20,7 +19,7 @@ internal suspend inline fun BC. /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call - * @param subcontextUpdatesFilter **Default is [InlineQueryFilterByUser]]**. This filter will be applied to each update inside of [scenarioReceiver]. For example, + * @param subcontextUpdatesFilter **Default is [null]]**. This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * 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] @@ -32,7 +31,7 @@ internal suspend inline fun BC. */ suspend fun BC.onAnyInlineQuery( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = InlineQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserInlineQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onInlineQuery(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -40,7 +39,7 @@ suspend fun BC.onAnyInlineQuery( /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call - * @param subcontextUpdatesFilter **Default is [InlineQueryFilterByUser]]**. This filter will be applied to each update inside of [scenarioReceiver]. For example, + * @param subcontextUpdatesFilter **Default is [null]]**. This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * 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] @@ -52,7 +51,7 @@ suspend fun BC.onAnyInlineQuery( */ suspend fun BC.onBaseInlineQuery( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = InlineQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserInlineQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onInlineQuery(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) @@ -60,7 +59,7 @@ suspend fun BC.onBaseInlineQuery( /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call - * @param subcontextUpdatesFilter **Default is [InlineQueryFilterByUser]]**. This filter will be applied to each update inside of [scenarioReceiver]. For example, + * @param subcontextUpdatesFilter **Default is [null]]**. This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * 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] @@ -72,7 +71,7 @@ suspend fun BC.onBaseInlineQuery( */ suspend fun BC.onLocationInlineQuery( initialFilter: SimpleFilter? = null, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = InlineQueryFilterByUser, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory = ByUserInlineQueryMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = onInlineQuery(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)