mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
buildBot
This commit is contained in:
parent
7c43d3aaa5
commit
a193ef5fd5
@ -7,6 +7,8 @@
|
|||||||
* `Klock`: `2.0.0` -> `2.0.1`
|
* `Klock`: `2.0.0` -> `2.0.1`
|
||||||
* `Ktor`: `1.4.2` -> `1.4.3`
|
* `Ktor`: `1.4.2` -> `1.4.3`
|
||||||
* `MicroUtils`: `0.4.6` -> `0.4.9`
|
* `MicroUtils`: `0.4.6` -> `0.4.9`
|
||||||
|
* `API Extensions`:
|
||||||
|
* New function `buildBot`
|
||||||
|
|
||||||
## 0.30.9
|
## 0.30.9
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.extensions.api
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
||||||
|
import dev.inmo.tgbotapi.utils.telegramBotAPIDefaultUrl
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.HttpClient
|
||||||
import io.ktor.client.HttpClientConfig
|
import io.ktor.client.HttpClientConfig
|
||||||
import io.ktor.client.engine.*
|
import io.ktor.client.engine.*
|
||||||
@ -36,10 +37,25 @@ data class BotBuilder internal constructor(
|
|||||||
* @return Created by [telegramBotWithCustomClientConfig] function [TelegramBot]. This executor will be preconfigured using [token] and
|
* @return Created by [telegramBotWithCustomClientConfig] function [TelegramBot]. This executor will be preconfigured using [token] and
|
||||||
* [block]
|
* [block]
|
||||||
*/
|
*/
|
||||||
|
fun buildBot(
|
||||||
|
token: String,
|
||||||
|
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||||
|
block: BotBuilder.() -> Unit
|
||||||
|
) = telegramBot(
|
||||||
|
TelegramAPIUrlsKeeper(token, apiUrl),
|
||||||
|
BotBuilder().apply(block).createHttpClient()
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Created by [telegramBotWithCustomClientConfig] function [TelegramBot]. This executor will be preconfigured using [token] and
|
||||||
|
* [block]
|
||||||
|
*/
|
||||||
|
@Deprecated("Renamed", ReplaceWith("buildBot", "dev.inmo.tgbotapi.extensions.api.buildBot"))
|
||||||
fun telegramBot(
|
fun telegramBot(
|
||||||
token: String,
|
token: String,
|
||||||
block: BotBuilder.() -> Unit
|
block: BotBuilder.() -> Unit
|
||||||
): TelegramBot = telegramBot(
|
): TelegramBot = buildBot(
|
||||||
TelegramAPIUrlsKeeper(token),
|
token,
|
||||||
BotBuilder().apply(block).createHttpClient()
|
telegramBotAPIDefaultUrl,
|
||||||
|
block
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user