diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/Ktor/KtorRequestsExecutor.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/Ktor/KtorRequestsExecutor.kt index cdaf835e84..db18339ec3 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/Ktor/KtorRequestsExecutor.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/Ktor/KtorRequestsExecutor.kt @@ -31,6 +31,16 @@ inline fun telegramBot( crossinline builder: KtorRequestsExecutorBuilder.() -> Unit = {} ): TelegramBot = KtorRequestsExecutorBuilder(telegramAPIUrlsKeeper).apply(builder).build() +/** + * Shortcut for [telegramBot] + */ +@Suppress("NOTHING_TO_INLINE") +inline fun telegramBot( + token: String, + apiUrl: String = telegramBotAPIDefaultUrl, + crossinline builder: KtorRequestsExecutorBuilder.() -> Unit = {} +): TelegramBot = telegramBot(TelegramAPIUrlsKeeper(token, apiUrl), builder) + class KtorRequestsExecutor( telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper, client: HttpClient = HttpClient(), diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/BotExtensions.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/BotExtensions.kt index 606018acbb..18c1c2bcfb 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/BotExtensions.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/BotExtensions.kt @@ -1,5 +1,6 @@ package dev.inmo.tgbotapi.extensions.api +import dev.inmo.tgbotapi.bot.Ktor.KtorRequestsExecutorBuilder import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper import dev.inmo.tgbotapi.utils.telegramBotAPIDefaultUrl @@ -71,11 +72,12 @@ inline fun telegramBot( /** * Allows to create bot using bot [token], [apiUrl] (for custom api servers) and already prepared [client] */ +@Deprecated("Replaced in core", ReplaceWith("telegramBot", "dev.inmo.tgbotapi.bot.Ktor.telegramBot")) @Suppress("NOTHING_TO_INLINE") inline fun telegramBot( token: String, apiUrl: String = telegramBotAPIDefaultUrl -): TelegramBot = telegramBot(TelegramAPIUrlsKeeper(token, apiUrl)) +): TelegramBot = dev.inmo.tgbotapi.bot.Ktor.telegramBot(token, apiUrl) /** * Allows to create bot using bot [token], [apiUrl] (for custom api servers) and already prepared [client]