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

Compare commits

...

7 Commits

Author SHA1 Message Date
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
7 changed files with 35 additions and 8 deletions

View File

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

View File

@@ -1,7 +1,20 @@
# TelegramBotAPI changelog
## 29.0.1
* `Core`:
* Fix of [#917](https://github.com/InsanusMokrassar/ktgbotapi/issues/917): all `OrderInfo` fields now have defaults nulls
## 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`:

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) |
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|

View File

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

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 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 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 component2 ()Ljava/lang/String;
public final fun component3 ()Ljava/lang/String;

View File

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

View File

@@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.utils
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.merge
@@ -53,5 +54,16 @@ suspend fun <T> firstOfOrNull(
suspend fun <T> firstOf(
vararg deferreds: suspend () -> 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()
}