mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-27 19:17:12 +00:00
add shareToStory in WebApp
This commit is contained in:
parent
88008b7cfc
commit
010c52adeb
@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.webapps.cloud.CloudStorage
|
||||
import dev.inmo.tgbotapi.webapps.haptic.HapticFeedback
|
||||
import dev.inmo.tgbotapi.webapps.invoice.InvoiceClosedInfo
|
||||
import dev.inmo.tgbotapi.webapps.popup.*
|
||||
import dev.inmo.tgbotapi.webapps.stories.StoryShareParams
|
||||
|
||||
external class WebApp {
|
||||
val version: String
|
||||
@ -101,6 +102,8 @@ external class WebApp {
|
||||
fun openTelegramLink(url: String)
|
||||
fun openInvoice(url: String, callback: (InvoiceClosedInfo) -> Unit = definedExternally)
|
||||
|
||||
fun shareToStory(mediaUrl: String, params: StoryShareParams?)
|
||||
|
||||
fun requestWriteAccess(callback: ((Boolean) -> Unit)? = definedExternally)
|
||||
fun requestContact(callback: ((Boolean) -> Unit)? = definedExternally)
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
package dev.inmo.tgbotapi.webapps.stories
|
||||
|
||||
external interface StoryShareParams {
|
||||
val text: String
|
||||
@JsName("widget_link")
|
||||
val widgetLink: StoryWidgetLink?
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package dev.inmo.tgbotapi.webapps.stories
|
||||
|
||||
import kotlin.js.json
|
||||
|
||||
external interface StoryWidgetLink {
|
||||
val url: String
|
||||
val name: String?
|
||||
}
|
||||
|
||||
fun StoryWidgetLink(
|
||||
url: String,
|
||||
name: String?
|
||||
): StoryWidgetLink {
|
||||
val result: dynamic = js("{}")
|
||||
result["url"] = url
|
||||
name ?.let { result["name"] = it }
|
||||
return result.unsafeCast<StoryWidgetLink>()
|
||||
}
|
Loading…
Reference in New Issue
Block a user