2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/@file:Suppress("unused", "UNCHECKED_CAST")
|
2021-09-13 17:30:01 +00:00
|
|
|
|
|
|
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling
|
|
|
|
|
|
|
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
|
|
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.CommonMessageFilterExcludeMediaGroups
|
|
|
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.MessageFilterByChat
|
|
|
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByChatMessageMarkerFactory
|
|
|
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
|
2022-08-05 10:31:39 +00:00
|
|
|
import dev.inmo.tgbotapi.extensions.utils.editMessageUpdateOrNull
|
2021-09-13 17:30:01 +00:00
|
|
|
import dev.inmo.tgbotapi.extensions.utils.withContent
|
2022-04-17 12:15:24 +00:00
|
|
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
2021-09-13 17:30:01 +00:00
|
|
|
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
|
|
|
import dev.inmo.tgbotapi.types.message.content.*
|
2022-05-01 05:52:02 +00:00
|
|
|
import dev.inmo.tgbotapi.types.message.content.AudioMediaGroupContent
|
|
|
|
import dev.inmo.tgbotapi.types.message.content.DocumentMediaGroupContent
|
|
|
|
import dev.inmo.tgbotapi.types.message.content.InvoiceContent
|
|
|
|
import dev.inmo.tgbotapi.types.message.content.MediaCollectionContent
|
|
|
|
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
|
|
|
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
2021-09-13 17:30:01 +00:00
|
|
|
import dev.inmo.tgbotapi.types.update.abstracts.BaseEditMessageUpdate
|
|
|
|
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
|
|
|
|
2021-10-13 08:22:01 +00:00
|
|
|
internal suspend inline fun <BC : BehaviourContext, reified T : MessageContent> BC.onEditedContent(
|
2022-04-21 09:42:32 +00:00
|
|
|
initialFilter: CommonMessageFilter<T>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<T>, Update>? = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in CommonMessage<T>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<T>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) {
|
|
|
|
when (it) {
|
2022-08-05 10:31:39 +00:00
|
|
|
is BaseEditMessageUpdate -> (it.editMessageUpdateOrNull() ?.data ?.withContent<T>())
|
2021-09-13 17:30:01 +00:00
|
|
|
else -> null
|
|
|
|
} ?.let(::listOfNotNull)
|
|
|
|
}
|
|
|
|
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedContentMessage(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<MessageContent>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<MessageContent>, Update> = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in CommonMessage<MessageContent>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<MessageContent>>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedContact(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<ContactContent>? = CommonMessageFilterExcludeMediaGroups,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ContactMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in ContactMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ContactMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedDice(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<DiceContent>? = CommonMessageFilterExcludeMediaGroups,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, DiceMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in DiceMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, DiceMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedGame(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<GameContent>? = CommonMessageFilterExcludeMediaGroups,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, GameMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in GameMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, GameMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedLocation(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<LocationContent>? = CommonMessageFilterExcludeMediaGroups,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, LocationMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in LocationMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, LocationMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedText(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in TextMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, TextMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedVenue(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<VenueContent>? = CommonMessageFilterExcludeMediaGroups,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, VenueMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in VenueMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, VenueMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedAudioMediaGroup(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<AudioMediaGroupContent>? = null,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, AudioMediaGroupMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in AudioMediaGroupMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, AudioMediaGroupMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedDocumentMediaGroupContent(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<DocumentMediaGroupContent>? = null,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, DocumentMediaGroupMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in DocumentMediaGroupMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, DocumentMediaGroupMessage>
|
2022-04-03 13:48:48 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
|
|
|
subcontextUpdatesFilter,
|
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter 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]
|
|
|
|
* to combinate several filters
|
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedTextedMediaContent(
|
|
|
|
initialFilter: CommonMessageFilter<TextedMediaContent>? = null,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextedMediaMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in TextedMediaMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, TextedMediaMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedMediaCollection(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<MediaCollectionContent<TelegramMediaFile>>? = null,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaCollectionMessage<TelegramMediaFile>, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in MediaCollectionMessage<TelegramMediaFile>, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaCollectionMessage<TelegramMediaFile>>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedMedia(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<MediaContent>? = null,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in MediaMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedAnimation(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<AnimationContent>? = CommonMessageFilterExcludeMediaGroups,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, AnimationMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in AnimationMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, AnimationMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedAudio(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<AudioContent>? = null,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, AudioMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in AudioMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, AudioMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedDocument(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<DocumentContent>? = null,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, DocumentMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in DocumentMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, DocumentMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedPhoto(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<PhotoContent>? = null,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, PhotoMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in PhotoMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, PhotoMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedSticker(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<StickerContent>? = CommonMessageFilterExcludeMediaGroups,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, StickerMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in StickerMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, StickerMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedVideo(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<VideoContent>? = null,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, VideoMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in VideoMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, VideoMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedVideoNote(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<VideoNoteContent>? = CommonMessageFilterExcludeMediaGroups,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, VideoNoteMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in VideoNoteMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, VideoNoteMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedVoice(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<VoiceContent>? = CommonMessageFilterExcludeMediaGroups,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, VoiceMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in VoiceMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, VoiceMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
|
|
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
2021-09-21 15:36:52 +00:00
|
|
|
* 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]
|
|
|
|
* to combinate several filters
|
2021-09-15 08:58:45 +00:00
|
|
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
|
|
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
|
|
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
|
|
|
* data
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onEditedInvoice(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: CommonMessageFilter<InvoiceContent>? = CommonMessageFilterExcludeMediaGroups,
|
2022-07-18 08:59:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, InvoiceMessage, Update> = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in InvoiceMessage, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, InvoiceMessage>
|
2021-09-13 17:30:01 +00:00
|
|
|
)= onEditedContent(
|
|
|
|
initialFilter,
|
2021-09-15 08:58:45 +00:00
|
|
|
subcontextUpdatesFilter,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory,
|
|
|
|
scenarioReceiver
|
|
|
|
)
|