telegramBot

inline fun telegramBot(bots: List<TelegramBot>, noinline botSelector: suspend List<TelegramBot>.(currentBotIndex: Int, t: Throwable?) -> TelegramBot = { i, _ -> getOrElse(i + 1) { first() } }, noinline onClose: () -> Unit = { bots.forEach(TelegramBot::close) }): TelegramBot

Creates SimpleMultiServerRequestsExecutor

Parameters

bots

Bots which will be used to SimpleMultiServerRequestsExecutor.executes

botSelector

It is strategy by which the bot is selected for the execution. This lambda will receive -1 when request execution just started and this call is first in context of one SimpleMultiServerRequestsExecutor.execute. By default, will select next TelegramBot when called (or first when current index is last or -1)

onClose

This method will be called inside of SimpleMultiServerRequestsExecutor.close method. By default, will close all bots


@JvmName(name = "telegramBotByApiUrlsKeepers")
inline fun telegramBot(keepers: Iterable<TelegramAPIUrlsKeeper>, crossinline builder: KtorRequestsExecutorBuilder.(TelegramAPIUrlsKeeper) -> Unit = {}, noinline botSelector: suspend List<TelegramBot>.(currentBotIndex: Int, t: Throwable?) -> TelegramBot = { i, _ -> getOrElse(i + 1) { first() } }, noinline onClose: (List<TelegramBot>) -> Unit? = null): TelegramBot

Parameters

keepers

Will be used to create result SimpleMultiServerRequestsExecutor.bots

builder

Will be called with each item from keepers in process of bots creation

botSelector

It is strategy by which the bot is selected for the execution. This lambda will receive -1 when request execution just started and this call is first in context of one SimpleMultiServerRequestsExecutor.execute. By default, will select next TelegramBot when called (or first when current index is last or -1)

onClose

This method will be called inside of SimpleMultiServerRequestsExecutor.close method. By default, will close all SimpleMultiServerRequestsExecutor.bots


@JvmName(name = "telegramBotByTokens")
inline fun telegramBot(tokens: Iterable<String>, crossinline builder: KtorRequestsExecutorBuilder.(String) -> Unit = {}, noinline botSelector: suspend List<TelegramBot>.(currentBotIndex: Int, t: Throwable?) -> TelegramBot = { i, _ -> getOrElse(i + 1) { first() } }, noinline onClose: (List<TelegramBot>) -> Unit? = null): TelegramBot

Parameters

tokens

Will be used to create result SimpleMultiServerRequestsExecutor.bots

builder

Will be called with each item from tokens in process of bots creation

botSelector

It is strategy by which the bot is selected for the execution. This lambda will receive -1 when request execution just started and this call is first in context of one SimpleMultiServerRequestsExecutor.execute. By default, will select next TelegramBot when called (or first when current index is last or -1)

onClose

This method will be called inside of SimpleMultiServerRequestsExecutor.close method. By default, will close all SimpleMultiServerRequestsExecutor.bots


@JvmName(name = "telegramBotByTokensAndApiUrls")
inline fun telegramBot(tokens: Iterable<Pair<String, String>>, crossinline builder: KtorRequestsExecutorBuilder.(Pair<String, String>) -> Unit = {}, noinline botSelector: suspend List<TelegramBot>.(currentBotIndex: Int, t: Throwable?) -> TelegramBot = { i, _ -> getOrElse(i + 1) { first() } }, noinline onClose: (List<TelegramBot>) -> Unit? = null): TelegramBot

Parameters

tokens

Pairs with first parameter as a token and second parameter api url. Will be used to create result SimpleMultiServerRequestsExecutor.bots

builder

Will be called with each item from tokens in process of bots creation

botSelector

It is strategy by which the bot is selected for the execution. This lambda will receive -1 when request execution just started and this call is first in context of one SimpleMultiServerRequestsExecutor.execute. By default, will select next TelegramBot when called (or first when current index is last or -1)

onClose

This method will be called inside of SimpleMultiServerRequestsExecutor.close method. By default, will close all SimpleMultiServerRequestsExecutor.bots