buildBehaviourWithFSM

suspend fun <T : State> TelegramBot.buildBehaviourWithFSM(upstreamUpdatesFlow: Flow<Update>? = null, scope: CoroutineScope = defaultCoroutineScopeProvider(), defaultExceptionsHandler: ExceptionHandler<Unit>? = null, statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()), presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(), fallbackHandler: BehaviourWithFSMStateHandlerHolder<T, T>? = null, onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(), block: CustomBehaviourContextReceiver<DefaultBehaviourContextWithFSM<T>, Unit>): DefaultBehaviourContextWithFSM<T>

Creates BehaviourContextWithFSM via creating of DefaultBehaviourContext with this as TelegramBot, scope as target scope for that DefaultBehaviourContext and upstreamUpdatesFlow. Pass statesManager to customize some internal logic of states changes. Pass presetHandlers in case you have some list of BehaviourWithFSMStateHandlerHolder with presets.

!!! WARNING !!! This method WILL NOT call BehaviourContextWithFSM.start of result object and WILL NOT start any updates retrieving. See buildBehaviourWithFSMAndStartLongPolling or telegramBotWithBehaviourAndFSMAndStartLongPolling in case you wish to start longPolling automatically


suspend fun <T : State> TelegramBot.buildBehaviourWithFSM(flowUpdatesFilter: FlowsUpdatesFilter, scope: CoroutineScope = defaultCoroutineScopeProvider(), defaultExceptionsHandler: ExceptionHandler<Unit>? = null, statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()), presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(), fallbackHandler: BehaviourWithFSMStateHandlerHolder<T, T>? = null, onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(), block: CustomBehaviourContextReceiver<DefaultBehaviourContextWithFSM<T>, Unit>): DefaultBehaviourContextWithFSM<T>

Creates BehaviourContextWithFSM via creating of DefaultBehaviourContext with this as TelegramBot, scope as target scope for that DefaultBehaviourContext and FlowsUpdatesFilter.allUpdatesFlow of flowUpdatesFilter as DefaultBehaviourContext.upstreamUpdatesFlow. Pass statesManager to customize some internal logic of states changes. Pass presetHandlers in case you have some list of BehaviourWithFSMStateHandlerHolder with presets. Use this method in case you wish to make some additional actions with flowUpdatesFilter.

!!! WARNING !!! This method WILL NOT call BehaviourContextWithFSM.start of result object and WILL NOT start any updates retrieving. See buildBehaviourWithFSMAndStartLongPolling or telegramBotWithBehaviourAndFSMAndStartLongPolling in case you wish to start longPolling automatically

See also