mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-02 22:59:48 +00:00
versions updates
This commit is contained in:
@@ -13,8 +13,8 @@ buildscript {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.multiplatform" version "$kotlin_version"
|
||||
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version"
|
||||
id "org.jetbrains.kotlin.multiplatform"
|
||||
id "org.jetbrains.kotlin.plugin.serialization"
|
||||
}
|
||||
|
||||
project.version = "$library_version"
|
||||
@@ -31,7 +31,10 @@ repositories {
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
js()
|
||||
js {
|
||||
browser()
|
||||
nodejs()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
|
@@ -6,6 +6,6 @@ import kotlinx.serialization.json.Json
|
||||
internal val nonstrictJsonFormat = Json {
|
||||
isLenient = true
|
||||
ignoreUnknownKeys = true
|
||||
serializeSpecialFloatingPointValues = true
|
||||
allowSpecialFloatingPointValues = true
|
||||
useArrayPolymorphism = true
|
||||
}
|
||||
|
@@ -8,11 +8,11 @@ import kotlinx.serialization.json.JsonElement
|
||||
/**
|
||||
* @return Deserialize [source] as [com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update]
|
||||
*/
|
||||
fun Json.toTelegramUpdate(source: String) = parse(UpdateDeserializationStrategy, source)
|
||||
fun Json.toTelegramUpdate(source: String) = decodeFromString(UpdateDeserializationStrategy, source)
|
||||
/**
|
||||
* @return Deserialize [source] as [com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update]
|
||||
*/
|
||||
fun Json.toTelegramUpdate(source: JsonElement) = fromJson(UpdateDeserializationStrategy, source)
|
||||
fun Json.toTelegramUpdate(source: JsonElement) = decodeFromJsonElement(UpdateDeserializationStrategy, source)
|
||||
|
||||
/**
|
||||
* @return Deserialize [this] as [com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update]. In fact,
|
||||
|
@@ -45,8 +45,8 @@ fun Route.includeWebhookHandlingInRoute(
|
||||
exceptionsHandler ?: {}
|
||||
) {
|
||||
val asJson =
|
||||
nonstrictJsonFormat.parseJson(call.receiveText())
|
||||
val update = nonstrictJsonFormat.fromJson(
|
||||
nonstrictJsonFormat.parseToJsonElement(call.receiveText())
|
||||
val update = nonstrictJsonFormat.decodeFromJsonElement(
|
||||
UpdateDeserializationStrategy,
|
||||
asJson
|
||||
)
|
||||
|
Reference in New Issue
Block a user