mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-10-22 15:50:08 +00:00
TelegramAPIUrlsKeeper
This commit is contained in:
@@ -18,7 +18,7 @@ import io.ktor.client.engine.cio.CIO
|
||||
import kotlinx.coroutines.*
|
||||
|
||||
fun KtorUpdatesPoller(
|
||||
token: String,
|
||||
telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper,
|
||||
timeoutSeconds: Int? = null,
|
||||
oneTimeUpdatesLimit: Int? = null,
|
||||
allowedUpdates: List<String> = ALL_UPDATES_LIST,
|
||||
@@ -26,7 +26,7 @@ fun KtorUpdatesPoller(
|
||||
updatesReceiver: UpdateReceiver<Update>
|
||||
): KtorUpdatesPoller {
|
||||
val executor = KtorRequestsExecutor(
|
||||
token,
|
||||
telegramAPIUrlsKeeper,
|
||||
HttpClient(
|
||||
CIO.create {
|
||||
timeoutSeconds ?.let { _ ->
|
||||
@@ -50,6 +50,25 @@ fun KtorUpdatesPoller(
|
||||
)
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated due to new TelegramAPIUrlsKeeper")
|
||||
fun KtorUpdatesPoller(
|
||||
token: String,
|
||||
timeoutSeconds: Int? = null,
|
||||
oneTimeUpdatesLimit: Int? = null,
|
||||
allowedUpdates: List<String> = ALL_UPDATES_LIST,
|
||||
exceptionsHandler: (Exception) -> Boolean = { true },
|
||||
updatesReceiver: UpdateReceiver<Update>
|
||||
): KtorUpdatesPoller {
|
||||
return KtorUpdatesPoller(
|
||||
TelegramAPIUrlsKeeper(token),
|
||||
timeoutSeconds,
|
||||
oneTimeUpdatesLimit,
|
||||
allowedUpdates,
|
||||
exceptionsHandler,
|
||||
updatesReceiver
|
||||
)
|
||||
}
|
||||
|
||||
class KtorUpdatesPoller(
|
||||
private val executor: RequestsExecutor,
|
||||
private val timeoutSeconds: Int? = null,
|
||||
|
Reference in New Issue
Block a user