From 8487ee1f31dcf61686fe39f52a45b47ef59452bb Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 23 Jan 2020 04:01:24 +0600 Subject: [PATCH] fixes in calling of "asUpdate" --- .../TelegramBotAPI/types/update/abstracts/Update.kt | 2 +- .../TelegramBotAPI/utils/extensions/Webhooks.kt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/Update.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/Update.kt index 157feb4f80..6d317c4071 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/Update.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/Update.kt @@ -36,7 +36,7 @@ internal object UpdateDeserializationStrategy : DeserializationStrategy RawUpdate.serializer(), asJson ).asUpdate( - asJson.toString() + asJson ) } } diff --git a/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/Webhooks.kt b/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/Webhooks.kt index 7ab7f2f320..1a6c82ce32 100644 --- a/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/Webhooks.kt +++ b/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/Webhooks.kt @@ -73,12 +73,12 @@ suspend fun RequestsExecutor.setWebhook( module { routing { post(listenRoute) { - val deserialized = call.receiveText() - val update = Json.nonstrict.parse( + val asJson = Json.nonstrict.parseJson(call.receiveText()) + val update = Json.nonstrict.fromJson( RawUpdate.serializer(), - deserialized + asJson ) - updatesChannel.send(update.asUpdate(deserialized)) + updatesChannel.send(update.asUpdate(asJson)) call.respond("Ok") } }