1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2026-06-27 05:35:13 +00:00

Compare commits

...

19 Commits

Author SHA1 Message Date
7ed021b5bc fill changelog 2025-10-21 22:24:58 +06:00
1cff533265 update dependencies and fix (?) build 2025-10-20 22:44:16 +06:00
8b08e11441 migrate onto 30.0.0 2025-10-20 21:21:31 +06:00
b69c8f1d8f update dependencies
com.github.ben-manes.versions: 0.52.0 -> 0.53.0
2025-10-19 23:33:10 +06:00
fdf393405c start 29.1.0 2025-10-19 22:57:12 +06:00
c951fc3353 Merge pull request #1010 from InsanusMokrassar/29.0.1
29.0.1
2025-10-13 23:10:42 +06:00
02f42c3f52 fix of name for publishing in nexus 2025-10-12 21:46:35 +06:00
0105e46a5f apiDump 2025-10-12 21:22:34 +06:00
325a189ebb fix of #917 2025-10-12 21:09:38 +06:00
1d021c8450 start 29.0.1 2025-10-12 21:07:55 +06:00
6eb9379e0a Merge pull request #998 from InsanusMokrassar/29.0.0
29.0.0
2025-09-25 15:07:02 +06:00
2d97d10ee1 fill changelog and readme 2025-09-25 14:25:22 +06:00
4b7d052ece rewrite firstOf 2025-09-25 14:25:08 +06:00
df512a917b Merge branch 'master' into 29.0.0 2025-09-23 18:21:13 +06:00
67cd836466 Merge pull request #1005 from InsanusMokrassar/28.0.3
28.0.3
2025-09-23 18:17:11 +06:00
eb1fb16117 add support of custom publishing type 2025-09-23 18:13:04 +06:00
ee4cf7c626 add passing of default engines in HttpClient constructors 2025-09-23 17:53:21 +06:00
74d8b31437 start 28.0.3 2025-09-23 17:46:54 +06:00
3f61cfdefb fix of paid message building 2025-09-23 16:12:40 +06:00
23 changed files with 136 additions and 28 deletions

View File

@@ -28,7 +28,7 @@ jobs:
env: env:
GITHUB_USER: ${{ github.actor }} GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to Gitea - name: Publish to InmoNexus
continue-on-error: true continue-on-error: true
run: ./gradlew publishAllPublicationsToInmoNexusRepository run: ./gradlew publishAllPublicationsToInmoNexusRepository
env: env:

View File

@@ -1,7 +1,37 @@
# TelegramBotAPI changelog # TelegramBotAPI changelog
## 30.0.0
**THIS UPDATE MAY CONTAINS BREAKING CHANGES**
* `Version`:
* `Kotlin`: `2.2.10` -> `2.2.20`
* `Ktor`: `3.2.3` -> `3.3.1`
* `MicroUtils`: `0.26.3` -> `0.26.6`
* `KSLog`: `1.5.0` -> `1.5.1`
* `BehaviourBuilder`:
* `DefaultCustomBehaviourContextAndTypeReceiver` now extends `suspend (BC, U) -> R` instead of `CustomBehaviourContextAndTypeReceiver<BC, R, U>` (no changes in api in fact)
## 29.0.1
* `Core`:
* Fix of [#917](https://github.com/InsanusMokrassar/ktgbotapi/issues/917): all `OrderInfo` fields now have defaults nulls
## 29.0.0 ## 29.0.0
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 9.2](https://core.telegram.org/bots/api-changelog#august-15-2025)**
**THIS UPDATE CONTAINS BREAKING CHANGES**
* `Core`:
* Add function `firstOfOrNull(vararg suspend () -> T): T?`
* Change logic of `firstOf` - now it works based on merged flows and __do not require__ `CoroutineScope` as receiver
## 28.0.3
* `Core`:
* Add passing of default engines in `HttpClient` constructors
## 28.0.2 ## 28.0.2
* `Core`: * `Core`:

View File

@@ -1,4 +1,4 @@
# TelegramBotAPI [![Maven Central Version](https://img.shields.io/maven-central/v/dev.inmo/tgbotapi)](https://central.sonatype.com/artifact/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-9.1-blue)](https://core.telegram.org/bots/api-changelog#july-3-2025) # TelegramBotAPI [![Maven Central Version](https://img.shields.io/maven-central/v/dev.inmo/tgbotapi)](https://central.sonatype.com/artifact/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-9.2-blue)](https://core.telegram.org/bots/api-changelog#august-15-2025)
| Docs | [![KDocs](https://img.shields.io/static/v1?label=Dokka&message=KDocs&color=blue&logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Mk&message=Docs&color=blue&logo=mkdocs)](https://docs.inmo.dev/tgbotapi/index.html) | | Docs | [![KDocs](https://img.shields.io/static/v1?label=Dokka&message=KDocs&color=blue&logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Mk&message=Docs&color=blue&logo=mkdocs)](https://docs.inmo.dev/tgbotapi/index.html) |
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| |:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|

View File

@@ -28,7 +28,7 @@ if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != n
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
validationTimeout = Duration.ofSeconds(0) validationTimeout = Duration.ofSeconds(0)
publishingType = "USER_MANAGED" publishingType = System.getenv('PUBLISHING_TYPE') != "" ? System.getenv('PUBLISHING_TYPE') : "USER_MANAGED"
} }
publishAllProjectsProbablyBreakingProjectIsolation() publishAllProjectsProbablyBreakingProjectIsolation()

View File

@@ -9,4 +9,4 @@ kotlin.incremental.js=true
ksp.useKSP2=false ksp.useKSP2=false
library_group=dev.inmo library_group=dev.inmo
library_version=29.0.0 library_version=30.0.0

View File

@@ -1,6 +1,6 @@
[versions] [versions]
kotlin = "2.2.10" kotlin = "2.2.20"
kotlin-serialization = "1.9.0" kotlin-serialization = "1.9.0"
kotlin-coroutines = "1.10.2" kotlin-coroutines = "1.10.2"
@@ -8,21 +8,21 @@ javax-activation = "1.1.1"
korlibs = "5.4.0" korlibs = "5.4.0"
uuid = "0.8.4" uuid = "0.8.4"
ktor = "3.2.3" ktor = "3.3.1"
ksp = "2.2.10-2.0.2" ksp = "2.2.20-2.0.4"
kotlin-poet = "2.2.0" kotlin-poet = "2.2.0"
microutils = "0.26.3" microutils = "0.26.6"
kslog = "1.5.0" kslog = "1.5.1"
versions = "0.52.0" versions = "0.53.0"
github-release-plugin = "2.5.2" github-release-plugin = "2.5.2"
dokka = "2.0.0" dokka = "2.0.0"
validator = "0.18.1" validator = "0.18.1"
nmcp = "1.1.0" nmcp = "1.2.0"
[libraries] [libraries]
@@ -37,6 +37,8 @@ kotlin-test-js = { module = "org.jetbrains.kotlin:kotlin-test-js", version.ref =
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" } ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
ktor-client-java = { module = "io.ktor:ktor-client-java", version.ref = "ktor" }
ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" } ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" }
ktor-client-winhttp = { module = "io.ktor:ktor-client-winhttp", version.ref = "ktor" } ktor-client-winhttp = { module = "io.ktor:ktor-client-winhttp", version.ref = "ktor" }
ktor-server = { module = "io.ktor:ktor-server", version.ref = "ktor" } ktor-server = { module = "io.ktor:ktor-server", version.ref = "ktor" }

View File

@@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.ktor.telegramBot import dev.inmo.tgbotapi.bot.ktor.telegramBot
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.defaultKtorEngine
import dev.inmo.tgbotapi.utils.telegramBotAPIDefaultUrl 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
@@ -13,7 +14,7 @@ import io.ktor.client.engine.*
*/ */
public fun telegramBot( public fun telegramBot(
urlsKeeper: TelegramAPIUrlsKeeper, urlsKeeper: TelegramAPIUrlsKeeper,
client: HttpClient = HttpClient() client: HttpClient = HttpClient(defaultKtorEngine)
): TelegramBot = telegramBot(urlsKeeper) { ): TelegramBot = telegramBot(urlsKeeper) {
this.client = client this.client = client
} }
@@ -68,7 +69,7 @@ public fun telegramBot(
apiUrl: String = telegramBotAPIDefaultUrl, apiUrl: String = telegramBotAPIDefaultUrl,
testServer: Boolean = false, testServer: Boolean = false,
fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" }, fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" },
client: HttpClient = HttpClient() client: HttpClient = HttpClient(defaultKtorEngine)
): TelegramBot = telegramBot(TelegramAPIUrlsKeeper(token, testServer, apiUrl, fileLinkUrlMapper), client) ): TelegramBot = telegramBot(TelegramAPIUrlsKeeper(token, testServer, apiUrl, fileLinkUrlMapper), client)
@Suppress("NOTHING_TO_INLINE") @Suppress("NOTHING_TO_INLINE")

View File

@@ -83,7 +83,7 @@ fun <BC : BehaviourContext, R, U : Update> CustomBehaviourContextAndTypeReceiver
*/ */
class DefaultCustomBehaviourContextAndTypeReceiver<BC : BehaviourContext, R, U : Update>( class DefaultCustomBehaviourContextAndTypeReceiver<BC : BehaviourContext, R, U : Update>(
private val wrapperReceiver: CustomBehaviourContextAndTypeReceiver<BC, R, U> private val wrapperReceiver: CustomBehaviourContextAndTypeReceiver<BC, R, U>
) : CustomBehaviourContextAndTypeReceiver<BC, R, U> { ) : suspend (BC, U) -> R {
private var botInfo: ExtendedBot? = null private var botInfo: ExtendedBot? = null
private val mutex = Mutex() private val mutex = Mutex()

View File

@@ -28487,7 +28487,9 @@ public final class dev/inmo/tgbotapi/types/payments/LabeledPricesSerializer : ko
public final class dev/inmo/tgbotapi/types/payments/OrderInfo { public final class dev/inmo/tgbotapi/types/payments/OrderInfo {
public static final field Companion Ldev/inmo/tgbotapi/types/payments/OrderInfo$Companion; public static final field Companion Ldev/inmo/tgbotapi/types/payments/OrderInfo$Companion;
public fun <init> ()V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/payments/ShippingAddress;)V public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/payments/ShippingAddress;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/payments/ShippingAddress;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/lang/String; public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String; public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Ljava/lang/String; public final fun component3 ()Ljava/lang/String;
@@ -31910,6 +31912,10 @@ public final class dev/inmo/tgbotapi/utils/DefaultKSLogKt {
public static final fun setDefaultKTgBotAPIKSLogSystemTag (Ljava/lang/String;)V public static final fun setDefaultKTgBotAPIKSLogSystemTag (Ljava/lang/String;)V
} }
public final class dev/inmo/tgbotapi/utils/DefaultKtorEngine_jvmKt {
public static final fun getDefaultKtorEngine ()Lio/ktor/client/engine/HttpClientEngineFactory;
}
public final class dev/inmo/tgbotapi/utils/DeserializeWithUnknownKt { public final class dev/inmo/tgbotapi/utils/DeserializeWithUnknownKt {
public static final fun deserializeEitherWithRaw (Lkotlinx/serialization/encoding/Decoder;Lkotlinx/serialization/KSerializer;)Ldev/inmo/micro_utils/common/Either; public static final fun deserializeEitherWithRaw (Lkotlinx/serialization/encoding/Decoder;Lkotlinx/serialization/KSerializer;)Ldev/inmo/micro_utils/common/Either;
public static final fun deserializeWithRaw (Lkotlinx/serialization/encoding/Decoder;Lkotlinx/serialization/KSerializer;)Lkotlin/Pair; public static final fun deserializeWithRaw (Lkotlinx/serialization/encoding/Decoder;Lkotlinx/serialization/KSerializer;)Lkotlin/Pair;

View File

@@ -47,12 +47,19 @@ kotlin {
api libs.ktor.server.host.common api libs.ktor.server.host.common
api libs.ktor.client.cio api libs.ktor.client.cio
api libs.ktor.client.java
api libs.javax.activation api libs.javax.activation
} }
} }
linuxX64Main { jsMain {
dependencies {
api libs.ktor.client.js
}
}
linuxMain {
dependencies { dependencies {
api libs.ktor.client.curl api libs.ktor.client.curl
} }
@@ -64,7 +71,7 @@ kotlin {
} }
} }
mingwX64Main { mingwMain {
dependencies { dependencies {
api libs.ktor.client.winhttp api libs.ktor.client.winhttp
} }

View File

@@ -8,6 +8,7 @@ import dev.inmo.tgbotapi.bot.settings.limiters.RequestLimiter
import dev.inmo.tgbotapi.requests.abstracts.Request import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
import dev.inmo.tgbotapi.utils.defaultKtorEngine
import dev.inmo.tgbotapi.utils.nonstrictJsonFormat import dev.inmo.tgbotapi.utils.nonstrictJsonFormat
import io.ktor.client.* import io.ktor.client.*
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
@@ -37,7 +38,7 @@ expect class KtorRequestsExecutor internal constructor(
fun KtorRequestsExecutor( fun KtorRequestsExecutor(
telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper, telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper,
client: HttpClient = HttpClient(), client: HttpClient = HttpClient(defaultKtorEngine),
callsFactories: List<KtorCallFactory> = emptyList(), callsFactories: List<KtorCallFactory> = emptyList(),
excludeDefaultFactories: Boolean = false, excludeDefaultFactories: Boolean = false,
requestsLimiter: RequestLimiter = ExceptionsOnlyLimiter, requestsLimiter: RequestLimiter = ExceptionsOnlyLimiter,

View File

@@ -21,7 +21,7 @@ fun createTelegramBotDefaultKtorCallRequestsFactories(logger: KSLog? = null) = l
class KtorRequestsExecutorBuilder( class KtorRequestsExecutorBuilder(
var telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper var telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper
) { ) {
var client: HttpClient = HttpClient() var client: HttpClient = HttpClient(defaultKtorEngine)
var callsFactories: List<KtorCallFactory> = emptyList() var callsFactories: List<KtorCallFactory> = emptyList()
var excludeDefaultFactories: Boolean = false var excludeDefaultFactories: Boolean = false
var requestsLimiter: RequestLimiter = ExceptionsOnlyLimiter var requestsLimiter: RequestLimiter = ExceptionsOnlyLimiter

View File

@@ -495,7 +495,7 @@ internal data class RawMessage(
} }
is PreviewPublicChat -> when (chat) { is PreviewPublicChat -> when (chat) {
is PreviewChannelChat -> if (is_paid_post) { is PreviewChannelChat -> if (is_paid_post) {
ChannelContentMessageImpl( ChannelPaidPostImpl(
messageId = messageId, messageId = messageId,
chat = chat, chat = chat,
senderChat = checkedFrom ?: sender_chat ?: chat, senderChat = checkedFrom ?: sender_chat ?: chat,
@@ -513,7 +513,7 @@ internal data class RawMessage(
cost = paid_star_count, cost = paid_star_count,
) )
} else { } else {
ChannelPaidPostImpl( ChannelContentMessageImpl(
messageId = messageId, messageId = messageId,
chat = chat, chat = chat,
senderChat = checkedFrom ?: sender_chat ?: chat, senderChat = checkedFrom ?: sender_chat ?: chat,

View File

@@ -14,11 +14,11 @@ import kotlinx.serialization.Serializable
@Serializable @Serializable
data class OrderInfo( data class OrderInfo(
@SerialName(nameField) @SerialName(nameField)
val name: String?, val name: String? = null,
@SerialName(phoneNumberField) @SerialName(phoneNumberField)
val phoneNumber: String?, val phoneNumber: String? = null,
@SerialName(emailField) @SerialName(emailField)
val email: String?, val email: String? = null,
@SerialName(shippingAddressField) @SerialName(shippingAddressField)
val shippingAddress: ShippingAddress? val shippingAddress: ShippingAddress? = null
) )

View File

@@ -0,0 +1,5 @@
package dev.inmo.tgbotapi.utils
import io.ktor.client.engine.HttpClientEngineFactory
expect val defaultKtorEngine: HttpClientEngineFactory<*>

View File

@@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.utils package dev.inmo.tgbotapi.utils
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.firstOrNull import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.merge import kotlinx.coroutines.flow.merge
@@ -53,5 +54,16 @@ suspend fun <T> firstOfOrNull(
suspend fun <T> firstOf( suspend fun <T> firstOf(
vararg deferreds: suspend () -> T vararg deferreds: suspend () -> T
): T { ): T {
return firstOfOrNull(*deferreds) ?: error("Unable to get result of deferreds") val resultFlow = deferreds.map {
flow {
runCatching {
it()
}.onSuccess {
emit(it)
}.onFailure {
if (it is CancellationException) throw it
}
}
}.merge()
return resultFlow.first()
} }

View File

@@ -0,0 +1,8 @@
package dev.inmo.tgbotapi.utils
import io.ktor.client.engine.HttpClientEngineFactory
import io.ktor.client.engine.js.Js
actual val defaultKtorEngine: HttpClientEngineFactory<*> by lazy {
Js
}

View File

@@ -0,0 +1,8 @@
package dev.inmo.tgbotapi.utils
import io.ktor.client.engine.HttpClientEngineFactory
import io.ktor.client.engine.java.Java
actual val defaultKtorEngine: HttpClientEngineFactory<*> by lazy {
Java
}

View File

@@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.bot.ktor.base package dev.inmo.tgbotapi.bot.ktor.base
import dev.inmo.tgbotapi.utils.defaultKtorEngine
import io.ktor.client.* import io.ktor.client.*
import io.ktor.client.engine.cio.* import io.ktor.client.engine.cio.*
@@ -21,4 +22,8 @@ internal actual inline fun platformClientCopy(client: HttpClient): HttpClient =
HttpClient(CIO) { HttpClient(CIO) {
this.plusAssign(config) this.plusAssign(config)
} }
} ?: throw IllegalArgumentException("On LinuxX64 TelegramBotAPI currently support only Curl Ktor HttpClient engine") } ?: HttpClient(
defaultKtorEngine
) {
install(client)
}

View File

@@ -0,0 +1,8 @@
package dev.inmo.tgbotapi.utils
import io.ktor.client.engine.HttpClientEngineFactory
import io.ktor.client.engine.curl.Curl
actual val defaultKtorEngine: HttpClientEngineFactory<*> by lazy {
Curl
}

View File

@@ -1,6 +1,8 @@
package dev.inmo.tgbotapi.bot.ktor.base package dev.inmo.tgbotapi.bot.ktor.base
import dev.inmo.tgbotapi.utils.defaultKtorEngine
import io.ktor.client.* import io.ktor.client.*
import io.ktor.client.HttpClient
import io.ktor.client.engine.curl.* import io.ktor.client.engine.curl.*
/** /**
@@ -21,4 +23,8 @@ internal actual inline fun platformClientCopy(client: HttpClient): HttpClient =
HttpClient(Curl) { HttpClient(Curl) {
this.plusAssign(config) this.plusAssign(config)
} }
} ?: throw IllegalArgumentException("On LinuxX64 TelegramBotAPI currently support only Curl Ktor HttpClient engine") } ?: HttpClient(
defaultKtorEngine
) {
install(client)
}

View File

@@ -0,0 +1,8 @@
package dev.inmo.tgbotapi.utils
import io.ktor.client.engine.HttpClientEngineFactory
import io.ktor.client.engine.winhttp.WinHttp
actual val defaultKtorEngine: HttpClientEngineFactory<*> by lazy {
WinHttp
}

View File

@@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.extensions.utils.extensions
import dev.inmo.tgbotapi.types.files.PathedFile import dev.inmo.tgbotapi.types.files.PathedFile
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
import dev.inmo.tgbotapi.utils.defaultKtorEngine
import io.ktor.client.HttpClient import io.ktor.client.HttpClient
import io.ktor.client.request.get import io.ktor.client.request.get
import io.ktor.client.statement.readBytes import io.ktor.client.statement.readBytes
@@ -19,5 +20,5 @@ suspend fun HttpClient.loadFile(
suspend fun PathedFile.download( suspend fun PathedFile.download(
telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper, telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper,
client: HttpClient = HttpClient() client: HttpClient = HttpClient(defaultKtorEngine)
) = client.loadFile(telegramAPIUrlsKeeper, this) ) = client.loadFile(telegramAPIUrlsKeeper, this)