diff --git a/tgbotapi.behaviour_builder.fsm/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/TelegramBotWithFSM.kt b/tgbotapi.behaviour_builder.fsm/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/TelegramBotWithFSM.kt index 23ead91b93..e7ef4fd5b3 100644 --- a/tgbotapi.behaviour_builder.fsm/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/TelegramBotWithFSM.kt +++ b/tgbotapi.behaviour_builder.fsm/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/TelegramBotWithFSM.kt @@ -22,10 +22,10 @@ import kotlin.coroutines.coroutineContext * **WARNING** This method WILL NOT launch any listening of updates. Use something like * [startGettingOfUpdatesByLongPolling] or tools for work with webhooks * - * @return Created bot which has been used to create [BehaviourContext] via [buildBehaviour] + * @return Created bot which has been used to create [BehaviourContext] via [buildBehaviourWithFSM] * * @see [BehaviourContext] - * @see [buildBehaviour] + * @see [buildBehaviourWithFSM] * @see startGettingOfUpdatesByLongPolling */ suspend fun telegramBotWithBehaviourAndFSM( @@ -60,8 +60,8 @@ suspend fun telegramBotWithBehaviourAndFSM( * @return Pair of [TelegramBot] and [Job]. This [Job] can be used to stop listening updates in your [block] you passed * here * - * @see [BehaviourContext] - * @see [buildBehaviour] + * @see BehaviourContext + * @see buildBehaviourWithFSMAndStartLongPolling * @see startGettingOfUpdatesByLongPolling */ suspend fun telegramBotWithBehaviourAndFSMAndStartLongPolling( diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourBuilders.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourBuilders.kt index 00e0a527d4..e6111623bd 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourBuilders.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourBuilders.kt @@ -54,7 +54,7 @@ suspend fun TelegramBot.buildBehaviour( * @see startGettingOfUpdatesByLongPolling */ @PreviewFeature -suspend fun TelegramBot.buildBehaviour( +suspend fun TelegramBot.buildBehaviourWithLongPolling( scope: CoroutineScope = defaultCoroutineScopeProvider(), defaultExceptionsHandler: ExceptionHandler? = null, block: BehaviourContextReceiver @@ -70,3 +70,11 @@ suspend fun TelegramBot.buildBehaviour( scope = scope ) } + +@PreviewFeature +@Deprecated("Renamed to buildBehaviourWithLongPolling") +suspend fun TelegramBot.buildBehaviour( + scope: CoroutineScope = defaultCoroutineScopeProvider(), + defaultExceptionsHandler: ExceptionHandler? = null, + block: BehaviourContextReceiver +) = buildBehaviourWithLongPolling(scope, defaultExceptionsHandler, block) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/TelegramBot.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/TelegramBot.kt index 613c923146..b0ab06183d 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/TelegramBot.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/TelegramBot.kt @@ -45,20 +45,19 @@ suspend fun telegramBotWithBehaviour( } /** - * Create bot using [telegramBot] and start listening for updates using [buildBehaviour]. + * Create bot using [telegramBot] and start listening for updates using [buildBehaviourWithLongPolling]. * Use this method in case you wish to make some additional actions with [flowsUpdatesFilter]. * - * **WARNING** This method WILL NOT launch any listening of updates. Use something like - * [startGettingOfUpdatesByLongPolling] or tools for work with webhooks + * **WARNING** This method WILL launch updates listening inside of calling [buildBehaviourWithLongPolling] * * @return Pair of [TelegramBot] and [Job]. This [Job] can be used to stop listening updates in your [block] you passed * here * * @see [BehaviourContext] - * @see [buildBehaviour] + * @see buildBehaviourWithLongPolling * @see startGettingOfUpdatesByLongPolling */ -suspend fun telegramBotWithBehaviour( +suspend fun telegramBotWithBehaviourAndLongPolling( token: String, scope: CoroutineScope? = null, apiUrl: String = telegramBotAPIDefaultUrl, @@ -71,10 +70,20 @@ suspend fun telegramBotWithBehaviour( apiUrl, builder ).let { - it to it.buildBehaviour( + it to it.buildBehaviourWithLongPolling( scope ?: CoroutineScope(coroutineContext), defaultExceptionsHandler, block ) } } + +@Deprecated("Renamed to telegramBotWithBehaviourAndLongPolling") +suspend fun telegramBotWithBehaviour( + token: String, + scope: CoroutineScope? = null, + apiUrl: String = telegramBotAPIDefaultUrl, + builder: KtorRequestsExecutorBuilder.() -> Unit = {}, + defaultExceptionsHandler: ExceptionHandler? = null, + block: BehaviourContextReceiver +) = telegramBotWithBehaviourAndLongPolling(token, scope, apiUrl, builder, defaultExceptionsHandler, block)