diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bc885c0d5..59b7ee2959 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ * All triggers have been changed to use two filters: filter for in subcontext data and filter for incoming data * New waiters for edited content * New extension `BehaviourContext#followLocation` + * Old API for triggers with the flags like `includeFilterByChatInBehaviourSubContext` have been deprecated ## 0.35.8 diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt index 25dcfec8c1..27d4e53266 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt @@ -20,7 +20,7 @@ internal suspend inline fun BehaviourContext.onCallb (it.asCallbackQueryUpdate() ?.data as? T) ?.let(::listOfNotNull) } - +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onDataCallbackQuery( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter? = null, @@ -32,6 +32,7 @@ suspend fun BehaviourContext.onDataCallbackQuery( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onGameShortNameCallbackQuery( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter? = null, @@ -43,6 +44,7 @@ suspend fun BehaviourContext.onGameShortNameCallbackQuery( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onInlineMessageIdCallbackQuery( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter? = null, @@ -54,6 +56,7 @@ suspend fun BehaviourContext.onInlineMessageIdCallbackQuery( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onInlineMessageIdDataCallbackQuery( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter? = null, @@ -65,6 +68,7 @@ suspend fun BehaviourContext.onInlineMessageIdDataCallbackQuery( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onInlineMessageIdGameShortNameCallbackQuery( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter? = null, @@ -76,6 +80,7 @@ suspend fun BehaviourContext.onInlineMessageIdGameShortNameCallbackQuery( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onMessageCallbackQuery( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter? = null, @@ -87,6 +92,7 @@ suspend fun BehaviourContext.onMessageCallbackQuery( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onMessageDataCallbackQuery( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter? = null, @@ -98,6 +104,7 @@ suspend fun BehaviourContext.onMessageDataCallbackQuery( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onMessageGameShortNameCallbackQuery( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter? = null, diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatMemberUpdatedTriggers.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatMemberUpdatedTriggers.kt index a4bd2bc3e7..9e9c2dbc0f 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatMemberUpdatedTriggers.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ChatMemberUpdatedTriggers.kt @@ -22,6 +22,7 @@ internal suspend inline fun BehaviourConte ((it as? U) ?.data) ?.let(::listOfNotNull) } +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onChatMemberUpdated( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter? = null, @@ -34,6 +35,7 @@ suspend fun BehaviourContext.onChatMemberUpdated( scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onCommonChatMemberUpdated( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter? = null, @@ -46,6 +48,7 @@ suspend fun BehaviourContext.onCommonChatMemberUpdated( scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onMyChatMemberUpdated( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter? = null, diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CommandHandling.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CommandHandling.kt index 2d40456a9f..6fc9e8317a 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CommandHandling.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CommandHandling.kt @@ -15,6 +15,7 @@ import dev.inmo.tgbotapi.types.message.content.TextContent import dev.inmo.tgbotapi.types.update.abstracts.Update import kotlinx.coroutines.Job +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.command( commandRegex: Regex, requireOnlyCommandInMessage: Boolean = true, @@ -42,6 +43,7 @@ suspend fun BehaviourContext.command( scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.command( command: String, requireOnlyCommandInMessage: Boolean = true, @@ -51,6 +53,7 @@ suspend fun BehaviourContext.command( scenarioReceiver: BehaviourContextAndTypeReceiver> ) = command(command.toRegex(), requireOnlyCommandInMessage, includeFilterByChatInBehaviourSubContext, additionalFilter, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend inline fun BehaviourContext.onCommand( commandRegex: Regex, requireOnlyCommandInMessage: Boolean = true, @@ -60,6 +63,7 @@ suspend inline fun BehaviourContext.onCommand( noinline scenarioReceiver: BehaviourContextAndTypeReceiver> ): Job = command(commandRegex, requireOnlyCommandInMessage, includeFilterByChatInBehaviourSubContext, additionalFilter, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend inline fun BehaviourContext.onCommand( command: String, requireOnlyCommandInMessage: Boolean = true, @@ -69,6 +73,7 @@ suspend inline fun BehaviourContext.onCommand( noinline scenarioReceiver: BehaviourContextAndTypeReceiver> ): Job = onCommand(command.toRegex(), requireOnlyCommandInMessage, includeFilterByChatInBehaviourSubContext, additionalFilter, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.commandWithArgs( commandRegex: Regex, includeFilterByChatInBehaviourSubContext: Boolean, @@ -89,6 +94,7 @@ suspend fun BehaviourContext.commandWithArgs( scenarioReceiver(it, args) } +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.commandWithArgs( command: String, includeFilterByChatInBehaviourSubContext: Boolean, @@ -103,6 +109,7 @@ suspend fun BehaviourContext.commandWithArgs( scenarioReceiver = scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend inline fun BehaviourContext.onCommandWithArgs( commandRegex: Regex, includeFilterByChatInBehaviourSubContext: Boolean, @@ -111,6 +118,7 @@ suspend inline fun BehaviourContext.onCommandWithArgs( noinline scenarioReceiver: BehaviourContextAndTwoTypesReceiver, Array> ): Job = commandWithArgs(commandRegex, includeFilterByChatInBehaviourSubContext, additionalFilter, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend inline fun BehaviourContext.onCommandWithArgs( command: String, includeFilterByChatInBehaviourSubContext: Boolean, diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ContentTriggers.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ContentTriggers.kt index f30450e9be..76d672d945 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ContentTriggers.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ContentTriggers.kt @@ -37,6 +37,7 @@ internal suspend inline fun BehaviourContext.onCont } } +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onContentMessage( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: CommonMessageFilter? = null, @@ -49,6 +50,7 @@ suspend fun BehaviourContext.onContentMessage( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onContact( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: CommonMessageFilter? = null, @@ -60,6 +62,7 @@ suspend fun BehaviourContext.onContact( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onDice( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: CommonMessageFilter? = null, @@ -71,6 +74,7 @@ suspend fun BehaviourContext.onDice( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onGame( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: CommonMessageFilter? = null, @@ -82,6 +86,7 @@ suspend fun BehaviourContext.onGame( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onLocation( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: CommonMessageFilter? = null, @@ -93,6 +98,7 @@ suspend fun BehaviourContext.onLocation( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onPoll( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: CommonMessageFilter? = null, @@ -104,6 +110,7 @@ suspend fun BehaviourContext.onPoll( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onText( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: CommonMessageFilter? = null, @@ -115,6 +122,7 @@ suspend fun BehaviourContext.onText( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onVenue( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: CommonMessageFilter? = null, @@ -126,6 +134,7 @@ suspend fun BehaviourContext.onVenue( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onAudioMediaGroup( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: CommonMessageFilter? = null, @@ -137,6 +146,7 @@ suspend fun BehaviourContext.onAudioMediaGroup( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onDocumentMediaGroupContent( includeFilterByChatInBehaviourSubContext: Boolean, includeMediaGroups: Boolean = true, @@ -149,6 +159,7 @@ suspend fun BehaviourContext.onDocumentMediaGroupContent( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onMediaCollection( includeFilterByChatInBehaviourSubContext: Boolean, includeMediaGroups: Boolean = false, @@ -161,6 +172,7 @@ suspend fun BehaviourContext.onMediaCollection( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onMedia( includeFilterByChatInBehaviourSubContext: Boolean, includeMediaGroups: Boolean = true, @@ -173,6 +185,7 @@ suspend fun BehaviourContext.onMedia( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onAnimation( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: CommonMessageFilter? = null, @@ -184,6 +197,7 @@ suspend fun BehaviourContext.onAnimation( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onAudio( includeFilterByChatInBehaviourSubContext: Boolean, includeMediaGroups: Boolean = false, @@ -196,6 +210,7 @@ suspend fun BehaviourContext.onAudio( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onDocument( includeFilterByChatInBehaviourSubContext: Boolean, includeMediaGroups: Boolean = false, @@ -208,6 +223,7 @@ suspend fun BehaviourContext.onDocument( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onPhoto( includeFilterByChatInBehaviourSubContext: Boolean, includeMediaGroups: Boolean = false, @@ -220,6 +236,7 @@ suspend fun BehaviourContext.onPhoto( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onSticker( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: CommonMessageFilter? = null, @@ -231,6 +248,7 @@ suspend fun BehaviourContext.onSticker( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onVideo( includeFilterByChatInBehaviourSubContext: Boolean, includeMediaGroups: Boolean = false, @@ -243,6 +261,7 @@ suspend fun BehaviourContext.onVideo( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onVideoNote( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: CommonMessageFilter? = null, @@ -254,6 +273,7 @@ suspend fun BehaviourContext.onVideoNote( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onVoice( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: CommonMessageFilter? = null, @@ -265,6 +285,7 @@ suspend fun BehaviourContext.onVoice( markerFactory, scenarioReceiver ) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onInvoice( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: CommonMessageFilter? = null, diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EventTriggers.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EventTriggers.kt index 5769e1d42b..1120f330b2 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EventTriggers.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EventTriggers.kt @@ -24,60 +24,70 @@ internal suspend inline fun BehaviourContext.onEvent( (it.asBaseSentMessageUpdate() ?.data ?.asChatEventMessage() ?.takeIf { it.chatEvent is T } as? ChatEventMessage) ?.let(::listOfNotNull) } +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onChannelEvent( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onChatEvent( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onVoiceChatEvent( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onVoiceChatStartedEvent( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onVoiceChatEndedEvent( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onVoiceChatParticipantsInvitedEvent( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onMessageAutoDeleteTimerChangedEvent( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onCommonEvent( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onGroupEvent( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onSupergroupEvent( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, @@ -85,60 +95,70 @@ suspend fun BehaviourContext.onSupergroupEvent( scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onChannelChatCreated( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onDeleteChatPhoto( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onGroupChatCreated( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onLeftChatMember( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onNewChatMembers( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onNewChatPhoto( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onNewChatTitle( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onPinnedMessage( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onProximityAlertTriggered( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver> ) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onSupergroupChatCreated( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>? = null, diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/InlineQueryTriggers.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/InlineQueryTriggers.kt index 6132fcefd3..2cef38eb5d 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/InlineQueryTriggers.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/InlineQueryTriggers.kt @@ -19,6 +19,7 @@ internal suspend inline fun BehaviourContext.onInlineQ } +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onAnyInlineQuery( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter? = null, @@ -26,6 +27,7 @@ suspend fun BehaviourContext.onAnyInlineQuery( scenarioReceiver: BehaviourContextAndTypeReceiver ) = onInlineQuery(additionalFilter, if (includeFilterByChatInBehaviourSubContext) InlineQueryFilterByUser else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onBaseInlineQuery( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter? = null, @@ -33,6 +35,7 @@ suspend fun BehaviourContext.onBaseInlineQuery( scenarioReceiver: BehaviourContextAndTypeReceiver ) = onInlineQuery(additionalFilter, if (includeFilterByChatInBehaviourSubContext) InlineQueryFilterByUser else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onLocationInlineQuery( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter? = null, diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MainTrigger.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MainTrigger.kt index bdc7bf8058..8556adc051 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MainTrigger.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MainTrigger.kt @@ -7,6 +7,9 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory import dev.inmo.tgbotapi.types.update.abstracts.Update +internal const val OldAPITriggersDeprecationText = "This signature of method has been deprecated. Use signature with the" + + " same name and subcontextUpdatesFilter/initialFilter instead" + internal suspend inline fun BehaviourContext.on( markerFactory: MarkerFactory, noinline initialFilter: SimpleFilter? = null, diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupTriggers.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupTriggers.kt index 68d8588c86..3982fa8125 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupTriggers.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupTriggers.kt @@ -25,42 +25,49 @@ internal suspend inline fun BehaviourContext.bui (it.asSentMediaGroupUpdate() ?.data ?.takeIf { it.all { it is T } } as? List>) ?.let(::listOfNotNull) } +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onMediaGroup( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>>? = null, markerFactory: MarkerFactory>, Any> = ByChatMediaGroupMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver>> ) = buildMediaGroupTrigger(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onPlaylist( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>>? = null, markerFactory: MarkerFactory>, Any> = ByChatMediaGroupMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver>> ) = buildMediaGroupTrigger(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onDocumentsGroup( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>>? = null, markerFactory: MarkerFactory>, Any> = ByChatMediaGroupMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver>> ) = buildMediaGroupTrigger(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onVisualGallery( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>>? = null, markerFactory: MarkerFactory>, Any> = ByChatMediaGroupMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver>> ) = buildMediaGroupTrigger(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onVisualMediaGroup( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>>? = null, markerFactory: MarkerFactory>, Any> = ByChatMediaGroupMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver>> ) = onVisualGallery(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onPhotoGallery( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>>? = null, markerFactory: MarkerFactory>, Any> = ByChatMediaGroupMarkerFactory, scenarioReceiver: BehaviourContextAndTypeReceiver>> ) = buildMediaGroupTrigger(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver) +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onVideoGallery( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter>>? = null, diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PassportTriggers.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PassportTriggers.kt index 56ab1e537e..0c32430b11 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PassportTriggers.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PassportTriggers.kt @@ -20,6 +20,7 @@ internal suspend inline fun BehaviourCont (it.asMessageUpdate() ?.data ?.asPassportMessage() ?.takeIf { it.passportData.data.any { it is T } }) ?.let(::listOfNotNull) } +@Deprecated(OldAPITriggersDeprecationText) suspend fun BehaviourContext.onPassportMessage( includeFilterByChatInBehaviourSubContext: Boolean, additionalFilter: SimpleFilter? = null,