mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 16:47:13 +00:00
deprecate old API in Behaviour Builder
This commit is contained in:
parent
5f01e26377
commit
94ad758814
@ -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
|
||||
|
||||
|
@ -20,7 +20,7 @@ internal suspend inline fun <reified T : CallbackQuery> BehaviourContext.onCallb
|
||||
(it.asCallbackQueryUpdate() ?.data as? T) ?.let(::listOfNotNull)
|
||||
}
|
||||
|
||||
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onDataCallbackQuery(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<DataCallbackQuery>? = null,
|
||||
@ -32,6 +32,7 @@ suspend fun BehaviourContext.onDataCallbackQuery(
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onGameShortNameCallbackQuery(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<GameShortNameCallbackQuery>? = null,
|
||||
@ -43,6 +44,7 @@ suspend fun BehaviourContext.onGameShortNameCallbackQuery(
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onInlineMessageIdCallbackQuery(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<InlineMessageIdCallbackQuery>? = null,
|
||||
@ -54,6 +56,7 @@ suspend fun BehaviourContext.onInlineMessageIdCallbackQuery(
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onInlineMessageIdDataCallbackQuery(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<InlineMessageIdDataCallbackQuery>? = null,
|
||||
@ -65,6 +68,7 @@ suspend fun BehaviourContext.onInlineMessageIdDataCallbackQuery(
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onInlineMessageIdGameShortNameCallbackQuery(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<InlineMessageIdGameShortNameCallbackQuery>? = null,
|
||||
@ -76,6 +80,7 @@ suspend fun BehaviourContext.onInlineMessageIdGameShortNameCallbackQuery(
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onMessageCallbackQuery(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<MessageCallbackQuery>? = null,
|
||||
@ -87,6 +92,7 @@ suspend fun BehaviourContext.onMessageCallbackQuery(
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onMessageDataCallbackQuery(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<MessageDataCallbackQuery>? = null,
|
||||
@ -98,6 +104,7 @@ suspend fun BehaviourContext.onMessageDataCallbackQuery(
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onMessageGameShortNameCallbackQuery(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<MessageGameShortNameCallbackQuery>? = null,
|
||||
|
@ -22,6 +22,7 @@ internal suspend inline fun <reified U : ChatMemberUpdatedUpdate> BehaviourConte
|
||||
((it as? U) ?.data) ?.let(::listOfNotNull)
|
||||
}
|
||||
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onChatMemberUpdated(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatMemberUpdated>? = null,
|
||||
@ -34,6 +35,7 @@ suspend fun BehaviourContext.onChatMemberUpdated(
|
||||
scenarioReceiver
|
||||
)
|
||||
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onCommonChatMemberUpdated(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatMemberUpdated>? = null,
|
||||
@ -46,6 +48,7 @@ suspend fun BehaviourContext.onCommonChatMemberUpdated(
|
||||
scenarioReceiver
|
||||
)
|
||||
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onMyChatMemberUpdated(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatMemberUpdated>? = null,
|
||||
|
@ -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<Unit, CommonMessage<TextContent>>
|
||||
) = 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<Unit, CommonMessage<TextContent>>
|
||||
): 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<Unit, CommonMessage<TextContent>>
|
||||
): 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<Unit, CommonMessage<TextContent>, Array<String>>
|
||||
): Job = commandWithArgs(commandRegex, includeFilterByChatInBehaviourSubContext, additionalFilter, markerFactory, scenarioReceiver)
|
||||
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend inline fun BehaviourContext.onCommandWithArgs(
|
||||
command: String,
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
|
@ -37,6 +37,7 @@ internal suspend inline fun <reified T : MessageContent> BehaviourContext.onCont
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onContentMessage(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: CommonMessageFilter<MessageContent>? = null,
|
||||
@ -49,6 +50,7 @@ suspend fun BehaviourContext.onContentMessage(
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onContact(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: CommonMessageFilter<ContactContent>? = null,
|
||||
@ -60,6 +62,7 @@ suspend fun BehaviourContext.onContact(
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onDice(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: CommonMessageFilter<DiceContent>? = null,
|
||||
@ -71,6 +74,7 @@ suspend fun BehaviourContext.onDice(
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onGame(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: CommonMessageFilter<GameContent>? = null,
|
||||
@ -82,6 +86,7 @@ suspend fun BehaviourContext.onGame(
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onLocation(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: CommonMessageFilter<LocationContent>? = null,
|
||||
@ -93,6 +98,7 @@ suspend fun BehaviourContext.onLocation(
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onPoll(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: CommonMessageFilter<PollContent>? = null,
|
||||
@ -104,6 +110,7 @@ suspend fun BehaviourContext.onPoll(
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onText(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: CommonMessageFilter<TextContent>? = null,
|
||||
@ -115,6 +122,7 @@ suspend fun BehaviourContext.onText(
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onVenue(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: CommonMessageFilter<VenueContent>? = null,
|
||||
@ -126,6 +134,7 @@ suspend fun BehaviourContext.onVenue(
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onAudioMediaGroup(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: CommonMessageFilter<AudioMediaGroupContent>? = 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<AnimationContent>? = 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<StickerContent>? = 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<VideoNoteContent>? = null,
|
||||
@ -254,6 +273,7 @@ suspend fun BehaviourContext.onVideoNote(
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onVoice(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: CommonMessageFilter<VoiceContent>? = null,
|
||||
@ -265,6 +285,7 @@ suspend fun BehaviourContext.onVoice(
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onInvoice(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: CommonMessageFilter<InvoiceContent>? = null,
|
||||
|
@ -24,60 +24,70 @@ internal suspend inline fun <reified T : ChatEvent> BehaviourContext.onEvent(
|
||||
(it.asBaseSentMessageUpdate() ?.data ?.asChatEventMessage() ?.takeIf { it.chatEvent is T } as? ChatEventMessage<T>) ?.let(::listOfNotNull)
|
||||
}
|
||||
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onChannelEvent(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<ChannelEvent>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<ChannelEvent>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<ChannelEvent>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onChatEvent(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<ChatEvent>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<ChatEvent>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<ChatEvent>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onVoiceChatEvent(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<VoiceChatEvent>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<VoiceChatEvent>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<VoiceChatEvent>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onVoiceChatStartedEvent(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<VoiceChatStarted>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<VoiceChatStarted>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<VoiceChatStarted>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onVoiceChatEndedEvent(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<VoiceChatEnded>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<VoiceChatEnded>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<VoiceChatEnded>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onVoiceChatParticipantsInvitedEvent(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<VoiceChatParticipantsInvited>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<VoiceChatParticipantsInvited>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<VoiceChatParticipantsInvited>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onMessageAutoDeleteTimerChangedEvent(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<MessageAutoDeleteTimerChanged>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<MessageAutoDeleteTimerChanged>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<MessageAutoDeleteTimerChanged>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onCommonEvent(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<CommonEvent>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<CommonEvent>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<CommonEvent>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onGroupEvent(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<GroupEvent>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<GroupEvent>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<GroupEvent>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onSupergroupEvent(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<SupergroupEvent>>? = null,
|
||||
@ -85,60 +95,70 @@ suspend fun BehaviourContext.onSupergroupEvent(
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<SupergroupEvent>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onChannelChatCreated(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<ChannelChatCreated>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<ChannelChatCreated>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<ChannelChatCreated>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onDeleteChatPhoto(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<DeleteChatPhoto>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<DeleteChatPhoto>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<DeleteChatPhoto>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onGroupChatCreated(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<GroupChatCreated>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<GroupChatCreated>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<GroupChatCreated>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onLeftChatMember(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<LeftChatMember>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<LeftChatMember>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<LeftChatMember>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onNewChatMembers(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<NewChatMembers>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<NewChatMembers>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<NewChatMembers>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onNewChatPhoto(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<NewChatPhoto>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<NewChatPhoto>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<NewChatPhoto>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onNewChatTitle(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<NewChatTitle>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<NewChatTitle>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<NewChatTitle>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onPinnedMessage(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<PinnedMessage>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<PinnedMessage>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<PinnedMessage>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onProximityAlertTriggered(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<ProximityAlertTriggered>>? = null,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<ProximityAlertTriggered>, Any> = ByChatMessageMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, ChatEventMessage<ProximityAlertTriggered>>
|
||||
) = onEvent(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessageFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onSupergroupChatCreated(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<ChatEventMessage<SupergroupChatCreated>>? = null,
|
||||
|
@ -19,6 +19,7 @@ internal suspend inline fun <reified T : InlineQuery> BehaviourContext.onInlineQ
|
||||
}
|
||||
|
||||
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onAnyInlineQuery(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<InlineQuery>? = null,
|
||||
@ -26,6 +27,7 @@ suspend fun BehaviourContext.onAnyInlineQuery(
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, InlineQuery>
|
||||
) = onInlineQuery(additionalFilter, if (includeFilterByChatInBehaviourSubContext) InlineQueryFilterByUser else null, markerFactory, scenarioReceiver)
|
||||
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onBaseInlineQuery(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<BaseInlineQuery>? = null,
|
||||
@ -33,6 +35,7 @@ suspend fun BehaviourContext.onBaseInlineQuery(
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, BaseInlineQuery>
|
||||
) = onInlineQuery(additionalFilter, if (includeFilterByChatInBehaviourSubContext) InlineQueryFilterByUser else null, markerFactory, scenarioReceiver)
|
||||
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onLocationInlineQuery(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<LocationInlineQuery>? = null,
|
||||
|
@ -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 <reified T> BehaviourContext.on(
|
||||
markerFactory: MarkerFactory<in T, Any>,
|
||||
noinline initialFilter: SimpleFilter<T>? = null,
|
||||
|
@ -25,42 +25,49 @@ internal suspend inline fun <reified T : MediaGroupContent> BehaviourContext.bui
|
||||
(it.asSentMediaGroupUpdate() ?.data ?.takeIf { it.all { it is T } } as? List<MediaGroupMessage<T>>) ?.let(::listOfNotNull)
|
||||
}
|
||||
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onMediaGroup(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<List<MediaGroupMessage<MediaGroupContent>>>? = null,
|
||||
markerFactory: MarkerFactory<in List<MediaGroupMessage<MediaGroupContent>>, Any> = ByChatMediaGroupMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, List<MediaGroupMessage<MediaGroupContent>>>
|
||||
) = buildMediaGroupTrigger(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onPlaylist(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<List<MediaGroupMessage<AudioMediaGroupContent>>>? = null,
|
||||
markerFactory: MarkerFactory<in List<MediaGroupMessage<AudioMediaGroupContent>>, Any> = ByChatMediaGroupMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, List<MediaGroupMessage<AudioMediaGroupContent>>>
|
||||
) = buildMediaGroupTrigger(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onDocumentsGroup(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<List<MediaGroupMessage<DocumentMediaGroupContent>>>? = null,
|
||||
markerFactory: MarkerFactory<in List<MediaGroupMessage<DocumentMediaGroupContent>>, Any> = ByChatMediaGroupMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, List<MediaGroupMessage<DocumentMediaGroupContent>>>
|
||||
) = buildMediaGroupTrigger(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onVisualGallery(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<List<MediaGroupMessage<VisualMediaGroupContent>>>? = null,
|
||||
markerFactory: MarkerFactory<in List<MediaGroupMessage<VisualMediaGroupContent>>, Any> = ByChatMediaGroupMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, List<MediaGroupMessage<VisualMediaGroupContent>>>
|
||||
) = buildMediaGroupTrigger(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onVisualMediaGroup(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<List<MediaGroupMessage<VisualMediaGroupContent>>>? = null,
|
||||
markerFactory: MarkerFactory<in List<MediaGroupMessage<VisualMediaGroupContent>>, Any> = ByChatMediaGroupMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, List<MediaGroupMessage<VisualMediaGroupContent>>>
|
||||
) = onVisualGallery(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onPhotoGallery(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<List<MediaGroupMessage<PhotoContent>>>? = null,
|
||||
markerFactory: MarkerFactory<in List<MediaGroupMessage<PhotoContent>>, Any> = ByChatMediaGroupMarkerFactory,
|
||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, List<MediaGroupMessage<PhotoContent>>>
|
||||
) = buildMediaGroupTrigger(additionalFilter, if (includeFilterByChatInBehaviourSubContext) MessagesFilterByChat else null, markerFactory, scenarioReceiver)
|
||||
@Deprecated(OldAPITriggersDeprecationText)
|
||||
suspend fun BehaviourContext.onVideoGallery(
|
||||
includeFilterByChatInBehaviourSubContext: Boolean,
|
||||
additionalFilter: SimpleFilter<List<MediaGroupMessage<VideoContent>>>? = null,
|
||||
|
@ -20,6 +20,7 @@ internal suspend inline fun <reified T : EncryptedPassportElement> 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<PassportMessage>? = null,
|
||||
|
Loading…
Reference in New Issue
Block a user