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

Compare commits

..

14 Commits

Author SHA1 Message Date
renovate[bot]
16eaef0b9c fix(deps): update ktor monorepo to v3.2.3 2025-08-10 12:06:46 +00:00
ba647ee5ab Update README.md 2025-08-06 17:46:43 +06:00
d2924ce1f2 Merge pull request #992 from InsanusMokrassar/27.1.2
27.1.2
2025-08-06 15:59:17 +06:00
72781487f0 add note about Something web wrong 2025-08-06 14:00:29 +06:00
de435e5dbc Merge pull request #986 from BlackBaroness/patch-1
fix: typo in default error messages
2025-08-06 13:57:59 +06:00
f975754058 try to fix cancelling on timeout for long polling 2025-08-06 13:14:22 +06:00
0f7536a21c start 27.1.2 2025-08-06 13:10:42 +06:00
d4c085c9b6 Merge pull request #991 from InsanusMokrassar/27.1.1
27.1.1
2025-08-04 01:59:53 +06:00
667c49f13d update dependencies 2025-08-04 01:36:56 +06:00
e1d9ebff90 jvmApiDump 2025-08-04 01:33:12 +06:00
fbc7088dad fix of #990 2025-08-04 01:25:16 +06:00
4ba9c8ee97 start 27.1.1 2025-08-04 01:24:02 +06:00
92611b5c26 Merge pull request #985 from InsanusMokrassar/27.1.0
27.1.0
2025-07-28 20:23:07 +06:00
BlackBaroness
0650fc594f fix: typo in default error messages 2025-07-27 07:34:56 +03:00
8 changed files with 35 additions and 22 deletions

View File

@@ -1,5 +1,18 @@
# 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

@@ -1,4 +1,4 @@
# TelegramBotAPI [![Maven Central Version](https://img.shields.io/maven-central/v/dev.inmo/tgbotapi)](https://maven-badges.herokuapp.com/maven-central/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.1-blue)](https://core.telegram.org/bots/api-changelog#july-3-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) |
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
@@ -136,4 +136,4 @@ to proxy requests for files to the server where bot api server has been hosted
(like `systemd-journal`) or be `101` UID user (like `systemd-resolve`)
* **OR** Use some reverse proxy (like nginx). It will allow you to broadcast your bots files without linux rights problems
* Set [TelegramAPIUrlsKeeper](tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/TelegramAPIUrlsKeeper.kt)#fileLinkUrlMapper
to map urls to let bot execute requests to your nginx proxy
to map urls to let bot execute requests to your nginx proxy

View File

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

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.0.0"
kotlin-poet = "2.2.0"
microutils = "0.26.1"
microutils = "0.26.2"
kslog = "1.5.0"
versions = "0.52.0"

View File

@@ -14550,6 +14550,7 @@ 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
val location: StaticLocation? = null
)

View File

@@ -13,7 +13,7 @@ import kotlin.coroutines.EmptyCoroutineContext
context(bot: TelegramBot)
fun CoroutineScope.launchWithBotLogger(
errorMessageBuilder: CoroutineScope.(Throwable) -> Any = { "Something web wrong" },
errorMessageBuilder: CoroutineScope.(Throwable) -> Any = { "Something went 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 web wrong" },
errorMessageBuilder: T.(Throwable) -> Any = { "Something went wrong" },
block: suspend (T) -> Unit
) = subscribeLoggingDropExceptions (
scope,

View File

@@ -1,5 +1,6 @@
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
@@ -107,17 +108,13 @@ fun TelegramBot.longPollingFlow(
lastUpdateIdentifier = update.updateId
}
}
}.onFailure {
it.causedCancellationException() ?.let {
cancel(it)
}
}
}
}
withContext(contextToWork) {
while (isActive) {
runCatching {
runCatchingLogging(logger = Log) {
execute(
GetUpdates(
offset = lastUpdateIdentifier?.plus(1),
@@ -128,14 +125,16 @@ fun TelegramBot.longPollingFlow(
updatesHandler(originalUpdates)
}
}.onFailure { e ->
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)
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)
}
}
}
}