mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-03 15:19:30 +00:00
add firstOf
This commit is contained in:
@@ -30671,6 +30671,10 @@ public final class dev/inmo/tgbotapi/utils/ExtractDataAndJsonFromDecoderKt {
|
||||
public static final fun decodeDataAndJson (Lkotlinx/serialization/encoding/Decoder;Lkotlinx/serialization/DeserializationStrategy;)Lkotlin/Pair;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/utils/FirstOfKt {
|
||||
public static final fun firstOf (Lkotlinx/coroutines/CoroutineScope;[Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/utils/IntProgress100Serializer : kotlinx/serialization/KSerializer {
|
||||
public static final field INSTANCE Ldev/inmo/tgbotapi/utils/IntProgress100Serializer;
|
||||
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
|
||||
|
@@ -21,6 +21,7 @@ object DownloadFileRequestCallFactory : KtorCallFactory {
|
||||
jsonFormatter: Json,
|
||||
): T? = (request as? DownloadFile)?.let {
|
||||
resolveFile(it.filePath) ?.let {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return@makeCall it.bytes() as T // Always ByteArray
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,14 @@
|
||||
package dev.inmo.tgbotapi.utils
|
||||
|
||||
import dev.inmo.micro_utils.coroutines.firstOf
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
suspend fun <T> CoroutineScope.firstOf(
|
||||
vararg deferreds: suspend () -> T
|
||||
): T = firstOf {
|
||||
deferreds.forEach {
|
||||
add {
|
||||
it()
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user