2021-09-13 17:30:01 +00:00
|
|
|
@file:Suppress("unused")
|
2021-01-07 11:24:58 +00:00
|
|
|
|
2021-09-13 17:30:01 +00:00
|
|
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling
|
2021-01-07 11:24:58 +00:00
|
|
|
|
2021-01-19 12:50:45 +00:00
|
|
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
2021-09-13 17:30:01 +00:00
|
|
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.MessageFilterByChat
|
2021-08-03 05:46:23 +00:00
|
|
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
|
2021-06-26 06:15:52 +00:00
|
|
|
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.baseSentMessageUpdateOrNull
|
|
|
|
import dev.inmo.tgbotapi.extensions.utils.chatEventMessageOrNull
|
2021-01-07 11:24:58 +00:00
|
|
|
import dev.inmo.tgbotapi.types.message.ChatEvents.*
|
|
|
|
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
|
2021-03-09 14:04:44 +00:00
|
|
|
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.*
|
2022-04-19 07:49:31 +00:00
|
|
|
import dev.inmo.tgbotapi.types.message.PrivateEventMessage
|
2021-01-07 11:24:58 +00:00
|
|
|
import dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage
|
2021-10-03 05:43:15 +00:00
|
|
|
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
|
2021-09-13 17:30:01 +00:00
|
|
|
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
2021-01-07 11:24:58 +00:00
|
|
|
|
2021-10-13 08:22:01 +00:00
|
|
|
internal suspend inline fun <BC : BehaviourContext, reified T : ChatEvent> BC.onEvent(
|
2022-04-21 09:42:32 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<T>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<T>, Update>? = MessageFilterByChat,
|
2021-06-26 06:15:52 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<T>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<T>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) {
|
2022-05-08 20:27:06 +00:00
|
|
|
@Suppress("UNCHECKED_CAST")
|
2022-08-05 10:31:39 +00:00
|
|
|
(it.baseSentMessageUpdateOrNull() ?.data ?.chatEventMessageOrNull() ?.takeIf { it.chatEvent is T } as? ChatEventMessage<T>) ?.let(::listOfNotNull)
|
2021-06-26 06:15:52 +00:00
|
|
|
}
|
2021-01-07 11:24:58 +00:00
|
|
|
|
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.onChannelEvent(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<ChannelEvent>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<ChannelEvent>, Update>? = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<ChannelEvent>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<ChannelEvent>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
2021-10-03 05:43:15 +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,
|
|
|
|
* 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
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onPrivateEvent(
|
2021-10-03 05:43:15 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<PrivateEvent>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<PrivateEvent>, Update>? = MessageFilterByChat,
|
2021-10-03 05:43:15 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<PrivateEvent>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<PrivateEvent>>
|
2021-10-03 05:43:15 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, 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.onChatEvent(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<ChatEvent>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<ChatEvent>, Update>? = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<ChatEvent>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<ChatEvent>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
2022-04-17 14:03:00 +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,
|
|
|
|
* 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.onVideoChatEvent(
|
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<VideoChatEvent>>? = null,
|
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<VideoChatEvent>, Update>? = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<VideoChatEvent>, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<VideoChatEvent>>
|
|
|
|
) = onEvent(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.onVideoChatStartedEvent(
|
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<VideoChatStarted>>? = null,
|
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<VideoChatStarted>, Update>? = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<VideoChatStarted>, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<VideoChatStarted>>
|
|
|
|
) = onEvent(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.onVideoChatEndedEvent(
|
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<VideoChatEnded>>? = null,
|
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<VideoChatEnded>, Update>? = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<VideoChatEnded>, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<VideoChatEnded>>
|
|
|
|
) = onEvent(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.onVideoChatParticipantsInvitedEvent(
|
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<VideoChatParticipantsInvited>>? = null,
|
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<VideoChatParticipantsInvited>, Update>? = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<VideoChatParticipantsInvited>, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<VideoChatParticipantsInvited>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, 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.onMessageAutoDeleteTimerChangedEvent(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<MessageAutoDeleteTimerChanged>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<MessageAutoDeleteTimerChanged>, Update>? = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<MessageAutoDeleteTimerChanged>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<MessageAutoDeleteTimerChanged>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
2021-09-15 08:58:45 +00:00
|
|
|
|
2021-10-03 05:43:15 +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,
|
|
|
|
* 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
|
|
|
|
*/
|
2021-10-13 08:22:01 +00:00
|
|
|
suspend fun <BC : BehaviourContext> BC.onPublicChatEvent(
|
2021-10-03 12:44:29 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<PublicChatEvent>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<PublicChatEvent>, Update>? = MessageFilterByChat,
|
2021-10-03 12:44:29 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<PublicChatEvent>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<PublicChatEvent>>
|
2021-10-03 05:43:15 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, 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.onCommonEvent(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<CommonEvent>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<CommonEvent>, Update>? = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<CommonEvent>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<CommonEvent>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, 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.onGroupEvent(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<GroupEvent>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<GroupEvent>, Update>? = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<GroupEvent>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<GroupEvent>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, 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.onSupergroupEvent(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<SupergroupEvent>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<SupergroupEvent>, Update>? = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<SupergroupEvent>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<SupergroupEvent>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, 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.onChannelChatCreated(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<ChannelChatCreated>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<ChannelChatCreated>, Update>? = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<ChannelChatCreated>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<ChannelChatCreated>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, 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.onDeleteChatPhoto(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<DeleteChatPhoto>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<DeleteChatPhoto>, Update>? = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<DeleteChatPhoto>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<DeleteChatPhoto>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, 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.onGroupChatCreated(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<GroupChatCreated>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<GroupChatCreated>, Update>? = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<GroupChatCreated>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<GroupChatCreated>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, 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.onLeftChatMember(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<LeftChatMember>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<LeftChatMember>, Update>? = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<LeftChatMember>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<LeftChatMember>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, 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.onNewChatMembers(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<NewChatMembers>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<NewChatMembers>, Update>? = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<NewChatMembers>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<NewChatMembers>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, 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.onNewChatPhoto(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<NewChatPhoto>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<NewChatPhoto>, Update>? = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<NewChatPhoto>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<NewChatPhoto>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, 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.onNewChatTitle(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<NewChatTitle>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<NewChatTitle>, Update>? = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<NewChatTitle>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<NewChatTitle>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, 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.onPinnedMessage(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<PinnedMessage>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<PinnedMessage>, Update>? = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<PinnedMessage>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<PinnedMessage>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, 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.onProximityAlertTriggered(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<ProximityAlertTriggered>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<ProximityAlertTriggered>, Update>? = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<ProximityAlertTriggered>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<ProximityAlertTriggered>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, 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.onSupergroupChatCreated(
|
2021-09-13 17:30:01 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<SupergroupChatCreated>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<SupergroupChatCreated>, Update>? = MessageFilterByChat,
|
2021-09-13 17:30:01 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<SupergroupChatCreated>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<SupergroupChatCreated>>
|
2021-09-13 17:30:01 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
2021-10-03 05:43:15 +00:00
|
|
|
|
|
|
|
/**
|
2021-10-15 11:40:23 +00:00
|
|
|
* Please, remember that [SuccessfulPaymentEvent] will be retrieved only in case you will correctly handle
|
|
|
|
* [dev.inmo.tgbotapi.types.payments.PreCheckoutQuery] (via [onPreCheckoutQuery], for example)
|
|
|
|
*
|
2021-10-03 05:43:15 +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,
|
|
|
|
* 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-10-15 11:40:23 +00:00
|
|
|
* @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
2021-10-03 05:43:15 +00:00
|
|
|
* 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.onSuccessfulPayment(
|
2021-10-03 05:43:15 +00:00
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<SuccessfulPaymentEvent>>? = null,
|
2021-10-13 08:22:01 +00:00
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<SuccessfulPaymentEvent>, Update>? = MessageFilterByChat,
|
2021-10-03 05:43:15 +00:00
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<SuccessfulPaymentEvent>, Any> = ByChatMessageMarkerFactory,
|
2021-10-13 08:22:01 +00:00
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<SuccessfulPaymentEvent>>
|
2021-10-03 05:43:15 +00:00
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
2022-01-06 08:49:11 +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,
|
|
|
|
* 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.onUserLoggedIn(
|
|
|
|
initialFilter: SimpleFilter<ChatEventMessage<UserLoggedIn>>? = null,
|
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<UserLoggedIn>, Update>? = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<UserLoggedIn>, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<UserLoggedIn>>
|
|
|
|
) = onEvent(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
2022-04-19 07:49:31 +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,
|
|
|
|
* 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.onWebAppData(
|
|
|
|
initialFilter: SimpleFilter<PrivateEventMessage<WebAppData>>? = null,
|
|
|
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, PrivateEventMessage<WebAppData>, Update>? = MessageFilterByChat,
|
|
|
|
markerFactory: MarkerFactory<in ChatEventMessage<WebAppData>, Any> = ByChatMessageMarkerFactory,
|
|
|
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, PrivateEventMessage<WebAppData>>
|
|
|
|
) = onEvent(
|
|
|
|
initialFilter ?.let { { it is PrivateEventMessage<WebAppData> && initialFilter(it) } },
|
2022-05-08 20:27:06 +00:00
|
|
|
subcontextUpdatesFilter ?.let { { message: ChatEventMessage<WebAppData>, update: Update -> message is PrivateEventMessage<WebAppData> && subcontextUpdatesFilter(message, update) } },
|
2022-04-19 07:49:31 +00:00
|
|
|
markerFactory
|
|
|
|
) {
|
|
|
|
if (it is PrivateEventMessage<WebAppData>) {
|
|
|
|
scenarioReceiver(it)
|
|
|
|
}
|
|
|
|
}
|