1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2026-06-10 17:47:20 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
renovate[bot]
78490c5b2b Update ktor monorepo to v3.2.3 2025-07-29 17:46:28 +00:00
7 changed files with 20 additions and 33 deletions

View File

@@ -1,18 +1,5 @@
# TelegramBotAPI changelog
## 27.1.2
* `Core`:
* Try to fix cancelling on timeout for long polling
* Since this update phrase `Something web wrong` will not happen from this library 😭
## 27.1.1
* `Version`:
* `MicroUtils`: `0.26.1` -> `0.26.2`
* `Core`:
* Make `BusinessLocation#location` optional (fix of [#990](https://github.com/InsanusMokrassar/ktgbotapi/issues/990))
## 27.1.0
* `Core`:

View File

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

View File

@@ -8,12 +8,12 @@ javax-activation = "1.1.1"
korlibs = "5.4.0"
uuid = "0.8.4"
ktor = "3.2.2"
ktor = "3.2.3"
ksp = "2.2.0-2.0.2"
kotlin-poet = "2.2.0"
kotlin-poet = "2.0.0"
microutils = "0.26.2"
microutils = "0.26.1"
kslog = "1.5.0"
versions = "0.52.0"

View File

@@ -14550,7 +14550,6 @@ public final class dev/inmo/tgbotapi/types/business_connection/BusinessIntro$Com
public final class dev/inmo/tgbotapi/types/business_connection/BusinessLocation {
public static final field Companion Ldev/inmo/tgbotapi/types/business_connection/BusinessLocation$Companion;
public fun <init> (Ljava/lang/String;Ldev/inmo/tgbotapi/types/location/StaticLocation;)V
public synthetic fun <init> (Ljava/lang/String;Ldev/inmo/tgbotapi/types/location/StaticLocation;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ldev/inmo/tgbotapi/types/location/StaticLocation;
public final fun copy (Ljava/lang/String;Ldev/inmo/tgbotapi/types/location/StaticLocation;)Ldev/inmo/tgbotapi/types/business_connection/BusinessLocation;

View File

@@ -11,5 +11,5 @@ data class BusinessLocation(
@SerialName(addressField)
val address: String,
@SerialName(locationField)
val location: StaticLocation? = null
val location: StaticLocation
)

View File

@@ -13,7 +13,7 @@ import kotlin.coroutines.EmptyCoroutineContext
context(bot: TelegramBot)
fun CoroutineScope.launchWithBotLogger(
errorMessageBuilder: CoroutineScope.(Throwable) -> Any = { "Something went wrong" },
errorMessageBuilder: CoroutineScope.(Throwable) -> Any = { "Something web wrong" },
context: CoroutineContext = EmptyCoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
block: suspend CoroutineScope.() -> Unit
@@ -28,7 +28,7 @@ fun CoroutineScope.launchWithBotLogger(
context(bot: TelegramBot)
fun <T> Flow<T>.subscribeWithBotLogger(
scope: CoroutineScope,
errorMessageBuilder: T.(Throwable) -> Any = { "Something went wrong" },
errorMessageBuilder: T.(Throwable) -> Any = { "Something web wrong" },
block: suspend (T) -> Unit
) = subscribeLoggingDropExceptions (
scope,

View File

@@ -1,6 +1,5 @@
package dev.inmo.tgbotapi.extensions.utils.updates.retrieving
import dev.inmo.kslog.common.logger
import dev.inmo.micro_utils.coroutines.*
import dev.inmo.tgbotapi.bot.RequestsExecutor
import dev.inmo.tgbotapi.bot.TelegramBot
@@ -108,13 +107,17 @@ fun TelegramBot.longPollingFlow(
lastUpdateIdentifier = update.updateId
}
}
}.onFailure {
it.causedCancellationException() ?.let {
cancel(it)
}
}
}
}
withContext(contextToWork) {
while (isActive) {
runCatchingLogging(logger = Log) {
runCatching {
execute(
GetUpdates(
offset = lastUpdateIdentifier?.plus(1),
@@ -125,16 +128,14 @@ fun TelegramBot.longPollingFlow(
updatesHandler(originalUpdates)
}
}.onFailure { e ->
runCatchingLogging(logger = Log) {
val isHttpRequestTimeoutException =
e is HttpRequestTimeoutException || (e is CommonBotException && e.cause is HttpRequestTimeoutException)
if (isHttpRequestTimeoutException && autoSkipTimeoutExceptions) {
return@onFailure
}
exceptionsHandler?.invoke(e)
if (e is RequestException) {
delay(1000L)
}
val isHttpRequestTimeoutException =
e is HttpRequestTimeoutException || (e is CommonBotException && e.cause is HttpRequestTimeoutException)
if (isHttpRequestTimeoutException && autoSkipTimeoutExceptions) {
return@onFailure
}
exceptionsHandler?.invoke(e)
if (e is RequestException) {
delay(1000L)
}
}
}