541 lines
34 KiB
Kotlin
541 lines
34 KiB
Kotlin
|
|
|
|
/**
|
|
* @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
|
|
*/@file:Suppress("unused", "UNCHECKED_CAST")
|
|
|
|
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
|
|
import dev.inmo.tgbotapi.extensions.utils.asEditMessageUpdate
|
|
import dev.inmo.tgbotapi.extensions.utils.withContent
|
|
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
|
|
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
|
import dev.inmo.tgbotapi.types.message.content.*
|
|
import dev.inmo.tgbotapi.types.message.content.abstracts.*
|
|
import dev.inmo.tgbotapi.types.message.content.media.*
|
|
import dev.inmo.tgbotapi.types.message.payments.InvoiceContent
|
|
import dev.inmo.tgbotapi.types.update.abstracts.BaseEditMessageUpdate
|
|
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
|
import dev.inmo.tgbotapi.utils.PreviewFeature
|
|
|
|
@PreviewFeature
|
|
internal suspend inline fun <BC : BehaviourContext, reified T : MessageContent> BC.onEditedContent(
|
|
noinline initialFilter: CommonMessageFilter<T>? = null,
|
|
noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<T>, Update>? = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<T>, Any> = ByChatMessageMarkerFactory,
|
|
noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<T>>
|
|
) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) {
|
|
when (it) {
|
|
is BaseEditMessageUpdate -> (it.asEditMessageUpdate() ?.data ?.withContent<T>())
|
|
else -> null
|
|
} ?.let(::listOfNotNull)
|
|
}
|
|
|
|
|
|
/**
|
|
* @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.onEditedContentMessage(
|
|
initialFilter: CommonMessageFilter<MessageContent>? = null,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<MessageContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<MessageContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<MessageContent>>
|
|
)= 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.onEditedContact(
|
|
initialFilter: CommonMessageFilter<ContactContent>? = CommonMessageFilterExcludeMediaGroups,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<ContactContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<ContactContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<ContactContent>>
|
|
)= 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.onEditedDice(
|
|
initialFilter: CommonMessageFilter<DiceContent>? = CommonMessageFilterExcludeMediaGroups,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<DiceContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<DiceContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<DiceContent>>
|
|
)= 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.onEditedGame(
|
|
initialFilter: CommonMessageFilter<GameContent>? = CommonMessageFilterExcludeMediaGroups,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<GameContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<GameContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<GameContent>>
|
|
)= 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.onEditedLocation(
|
|
initialFilter: CommonMessageFilter<LocationContent>? = CommonMessageFilterExcludeMediaGroups,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<LocationContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<LocationContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<LocationContent>>
|
|
)= onEditedContent(
|
|
initialFilter,
|
|
subcontextUpdatesFilter,
|
|
markerFactory,
|
|
scenarioReceiver
|
|
)
|
|
|
|
@Deprecated("Potentially, this trigger will never be used. Use `onPollUpdated` instead")
|
|
suspend fun <BC : BehaviourContext> BC.onEditedPoll(
|
|
initialFilter: CommonMessageFilter<PollContent>? = CommonMessageFilterExcludeMediaGroups,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<PollContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<PollContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<PollContent>>
|
|
)= 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.onEditedText(
|
|
initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<TextContent>>
|
|
)= 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.onEditedVenue(
|
|
initialFilter: CommonMessageFilter<VenueContent>? = CommonMessageFilterExcludeMediaGroups,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<VenueContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<VenueContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<VenueContent>>
|
|
)= 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.onEditedAudioMediaGroup(
|
|
initialFilter: CommonMessageFilter<AudioMediaGroupContent>? = null,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<AudioMediaGroupContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<AudioMediaGroupContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<AudioMediaGroupContent>>
|
|
)= 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.onEditedDocumentMediaGroupContent(
|
|
initialFilter: CommonMessageFilter<DocumentMediaGroupContent>? = null,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<DocumentMediaGroupContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<DocumentMediaGroupContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<DocumentMediaGroupContent>>
|
|
)= 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.onEditedMediaCollection(
|
|
initialFilter: CommonMessageFilter<MediaCollectionContent<TelegramMediaFile>>? = null,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<MediaCollectionContent<TelegramMediaFile>>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<MediaCollectionContent<TelegramMediaFile>>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<MediaCollectionContent<TelegramMediaFile>>>
|
|
)= 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.onEditedMedia(
|
|
initialFilter: CommonMessageFilter<MediaContent>? = null,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<MediaContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<MediaContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<MediaContent>>
|
|
)= 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.onEditedAnimation(
|
|
initialFilter: CommonMessageFilter<AnimationContent>? = CommonMessageFilterExcludeMediaGroups,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<AnimationContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<AnimationContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<AnimationContent>>
|
|
)= 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.onEditedAudio(
|
|
initialFilter: CommonMessageFilter<AudioContent>? = null,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<AudioContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<AudioContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<AudioContent>>
|
|
)= 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.onEditedDocument(
|
|
initialFilter: CommonMessageFilter<DocumentContent>? = null,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<DocumentContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<DocumentContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<DocumentContent>>
|
|
)= 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.onEditedPhoto(
|
|
initialFilter: CommonMessageFilter<PhotoContent>? = null,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<PhotoContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<PhotoContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<PhotoContent>>
|
|
)= 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.onEditedSticker(
|
|
initialFilter: CommonMessageFilter<StickerContent>? = CommonMessageFilterExcludeMediaGroups,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<StickerContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<StickerContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<StickerContent>>
|
|
)= 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.onEditedVideo(
|
|
initialFilter: CommonMessageFilter<VideoContent>? = null,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<VideoContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<VideoContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<VideoContent>>
|
|
)= 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.onEditedVideoNote(
|
|
initialFilter: CommonMessageFilter<VideoNoteContent>? = CommonMessageFilterExcludeMediaGroups,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<VideoNoteContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<VideoNoteContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<VideoNoteContent>>
|
|
)= 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.onEditedVoice(
|
|
initialFilter: CommonMessageFilter<VoiceContent>? = CommonMessageFilterExcludeMediaGroups,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<VoiceContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<VoiceContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<VoiceContent>>
|
|
)= 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.onEditedInvoice(
|
|
initialFilter: CommonMessageFilter<InvoiceContent>? = CommonMessageFilterExcludeMediaGroups,
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<InvoiceContent>, Update> = MessageFilterByChat,
|
|
markerFactory: MarkerFactory<in CommonMessage<InvoiceContent>, Any> = ByChatMessageMarkerFactory,
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<InvoiceContent>>
|
|
)= onEditedContent(
|
|
initialFilter,
|
|
subcontextUpdatesFilter,
|
|
markerFactory,
|
|
scenarioReceiver
|
|
)
|