Merge pull request #237 from InsanusMokrassar/0.30.10

0.30.10
This commit is contained in:
InsanusMokrassar 2020-12-08 14:25:00 +06:00 committed by GitHub
commit 1a3da33589
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 9 deletions

View File

@ -1,5 +1,16 @@
# TelegramBotAPI changelog
## 0.30.10
* `Common`:
* `Version`:
* `Kotlin`: `1.4.20` -> `1.4.21`
* `Klock`: `2.0.0` -> `2.0.1`
* `Ktor`: `1.4.2` -> `1.4.3`
* `MicroUtils`: `0.4.6` -> `0.4.11`
* `API Extensions`:
* New function `buildBot`
## 0.30.9
* `Common`:

View File

@ -1,3 +1,3 @@
dokka_version=1.4.0
dokka_version=1.4.20
org.gradle.jvmargs=-Xmx1024m

View File

@ -5,18 +5,18 @@ kotlin.js.generate.externals=true
kotlin.incremental=true
kotlin.incremental.js=true
kotlin_version=1.4.20
kotlin_version=1.4.21
kotlin_coroutines_version=1.4.2
kotlin_serialisation_runtime_version=1.0.1
klock_version=2.0.0
klock_version=2.0.1
uuid_version=0.2.3
ktor_version=1.4.2
ktor_version=1.4.3
micro_utils_version=0.4.6
micro_utils_version=0.4.11
javax_activation_version=1.1.1
library_group=dev.inmo
library_version=0.30.9
library_version=0.30.10
github_release_plugin_version=2.2.12

View File

@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
import dev.inmo.tgbotapi.utils.telegramBotAPIDefaultUrl
import io.ktor.client.HttpClient
import io.ktor.client.HttpClientConfig
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
* [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(
token: String,
block: BotBuilder.() -> Unit
): TelegramBot = telegramBot(
TelegramAPIUrlsKeeper(token),
BotBuilder().apply(block).createHttpClient()
): TelegramBot = buildBot(
token,
telegramBotAPIDefaultUrl,
block
)