telegramBotWithBehaviourAndFSMAndStartLongPolling

suspend fun <T : State> telegramBotWithBehaviourAndFSMAndStartLongPolling(token: String, scope: CoroutineScope? = null, apiUrl: String = telegramBotAPIDefaultUrl, builder: KtorRequestsExecutorBuilder.() -> Unit = {}, defaultExceptionsHandler: ExceptionHandler<Unit>? = null, statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()), presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(), fallbackHandler: BehaviourWithFSMStateHandlerHolder<T, T>? = null, testServer: Boolean = false, onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(), timeoutSeconds: Seconds = 30, autoDisableWebhooks: Boolean = true, autoSkipTimeoutExceptions: Boolean = true, mediaGroupsDebounceTimeMillis: Long? = 1000, block: CustomBehaviourContextReceiver<DefaultBehaviourContextWithFSM<T>, Unit>): Pair<TelegramBot, Job>

Create bot using telegramBot and start listening for updates using buildBehaviourWithFSMAndStartLongPolling. This method will launch updates retrieving via long polling inside of buildBehaviourWithFSMAndStartLongPolling

Return

Pair of TelegramBot and Job. This Job can be used to stop listening updates in your block you passed here

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