buildBehaviourWithFSMAndStartLongPolling

suspend fun <T : State> TelegramBot.buildBehaviourWithFSMAndStartLongPolling(upstreamUpdatesFlow: Flow<Update>? = null, scope: CoroutineScope = defaultCoroutineScopeProvider(), defaultExceptionsHandler: ExceptionHandler<Unit>? = null, statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()), presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(), onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(), timeoutSeconds: Seconds = 30, autoDisableWebhooks: Boolean = true, autoSkipTimeoutExceptions: Boolean = true, mediaGroupsDebounceTimeMillis: Long? = 1000, block: CustomBehaviourContextReceiver<DefaultBehaviourContextWithFSM<T>, Unit>): Pair<DefaultBehaviourContextWithFSM<T>, Job>

Use buildBehaviourWithFSM to create BehaviourContextWithFSM and launch getting of updates using longPolling. For longPolling will be used result BehaviourContextWithFSM for both parameters flowsUpdatesFilter and scope

Parameters

mediaGroupsDebounceTimeMillis

Will be used for calling of updateHandlerWithMediaGroupsAdaptation. Pass null in case you wish to enable classic way of updates handling, but in that mode some media group messages can be retrieved in different updates


suspend fun <T : State> TelegramBot.buildBehaviourWithFSMAndStartLongPolling(scope: CoroutineScope = defaultCoroutineScopeProvider(), defaultExceptionsHandler: ExceptionHandler<Unit>? = null, statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()), presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(), onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(), timeoutSeconds: Seconds = 30, autoDisableWebhooks: Boolean = true, autoSkipTimeoutExceptions: Boolean = true, mediaGroupsDebounceTimeMillis: Long? = 1000, block: CustomBehaviourContextReceiver<DefaultBehaviourContextWithFSM<T>, Unit>): Job

Use buildBehaviourWithFSM to create BehaviourContextWithFSM and launch getting of updates using longPolling. For longPolling will be used result BehaviourContextWithFSM for both parameters flowsUpdatesFilter and scope

Parameters

mediaGroupsDebounceTimeMillis

Will be used for calling of updateHandlerWithMediaGroupsAdaptation. Pass null in case you wish to enable classic way of updates handling, but in that mode some media group messages can be retrieved in different updates

See also