1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-10-19 06:10:11 +00:00

add KtorRequestsExecutorBuilder

This commit is contained in:
2020-11-17 16:06:25 +06:00
parent 0d19952ba7
commit 657e9aa770
3 changed files with 29 additions and 8 deletions

View File

@@ -1,6 +1,5 @@
package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.Ktor.KtorRequestsExecutor
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
import dev.inmo.tgbotapi.utils.telegramBotAPIDefaultUrl
@@ -11,11 +10,11 @@ import io.ktor.client.engine.*
/**
* Allows to create bot using bot [urlsKeeper]
*/
@Deprecated("Replaced in core", ReplaceWith("telegramBot", "dev.inmo.tgbotapi.bot.Ktor.telegramBot"))
fun telegramBot(
urlsKeeper: TelegramAPIUrlsKeeper
): TelegramBot = KtorRequestsExecutor(
urlsKeeper,
HttpClient()
): TelegramBot = dev.inmo.tgbotapi.bot.Ktor.telegramBot(
urlsKeeper
)
/**
@@ -24,10 +23,9 @@ fun telegramBot(
fun telegramBot(
urlsKeeper: TelegramAPIUrlsKeeper,
client: HttpClient
): TelegramBot = KtorRequestsExecutor(
urlsKeeper,
client
)
): TelegramBot = dev.inmo.tgbotapi.bot.Ktor.telegramBot(urlsKeeper) {
this.client = client
}
/**
* Allows to create bot using bot [urlsKeeper] and specify [HttpClientEngineFactory] by passing [clientFactory] param and optionally