1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-21 15:53:47 +00:00

fix using of json in new webapp types

This commit is contained in:
InsanusMokrassar 2024-08-01 17:41:02 +06:00
parent 8bb3095fb1
commit 2d11685b7b
2 changed files with 10 additions and 8 deletions

View File

@ -1,5 +1,7 @@
package dev.inmo.tgbotapi.webapps.stories
import kotlin.js.json
external interface StoryShareParams {
val text: String
@JsName("widget_link")
@ -10,8 +12,8 @@ fun StoryShareParams(
text: String,
widgetLink: StoryWidgetLink?
): StoryShareParams {
val result: dynamic = js("{}")
result["text"] = text
widgetLink ?.let { result["widget_link"] = it }
return result.unsafeCast<StoryShareParams>()
val json = json()
json["text"] = text
widgetLink ?.let { json["widget_link"] = it }
return json.unsafeCast<StoryShareParams>()
}

View File

@ -11,8 +11,8 @@ fun StoryWidgetLink(
url: String,
name: String?
): StoryWidgetLink {
val result: dynamic = js("{}")
result["url"] = url
name ?.let { result["name"] = it }
return result.unsafeCast<StoryWidgetLink>()
val json = json()
json["url"] = url
name ?.let { json["name"] = it }
return json.unsafeCast<StoryWidgetLink>()
}