SimpleMultiServerRequestsExecutor
class SimpleMultiServerRequestsExecutor(bots: List<TelegramBot>, botSelector: suspend List<TelegramBot>.(currentBotIndex: Int, t: Throwable?) -> TelegramBot = { i, _ ->
getOrElse(i + 1) { first() }
}, onClose: () -> Unit = {
bots.forEach(TelegramBot::close)
}) : RequestsExecutor
This type of RequestsExecutor (aka TelegramBot) has been created to aggregate several bots under the hood and make requests, for example, with changing of api url
Parameters
bots
Bots which will be used to 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 execute. By default, will select next TelegramBot when called (or first when current index is last or -1)
Constructors
Link copied to clipboard
constructor(bots: List<TelegramBot>, botSelector: suspend List<TelegramBot>.(currentBotIndex: Int, t: Throwable?) -> TelegramBot = { i, _ ->
getOrElse(i + 1) { first() }
}, onClose: () -> Unit = {
bots.forEach(TelegramBot::close)
})