mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2024-12-21 16:17:18 +00:00
start updating up to 18.2.0
This commit is contained in:
parent
346755b41c
commit
ab362e8c3b
@ -12,10 +12,7 @@ import dev.inmo.tgbotapi.extensions.api.send.send
|
|||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.telegramBotWithBehaviourAndLongPolling
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.telegramBotWithBehaviourAndLongPolling
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.*
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.*
|
||||||
import dev.inmo.tgbotapi.extensions.utils.extensions.sameChat
|
import dev.inmo.tgbotapi.extensions.utils.extensions.sameChat
|
||||||
import dev.inmo.tgbotapi.extensions.utils.types.buttons.dataButton
|
import dev.inmo.tgbotapi.extensions.utils.types.buttons.*
|
||||||
import dev.inmo.tgbotapi.extensions.utils.types.buttons.flatInlineKeyboard
|
|
||||||
import dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard
|
|
||||||
import dev.inmo.tgbotapi.extensions.utils.types.buttons.payButton
|
|
||||||
import dev.inmo.tgbotapi.extensions.utils.withContentOrNull
|
import dev.inmo.tgbotapi.extensions.utils.withContentOrNull
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.asMultipartFile
|
import dev.inmo.tgbotapi.requests.abstracts.asMultipartFile
|
||||||
import dev.inmo.tgbotapi.types.RawChatId
|
import dev.inmo.tgbotapi.types.RawChatId
|
||||||
@ -30,6 +27,7 @@ import dev.inmo.tgbotapi.types.message.content.TextContent
|
|||||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.payments.LabeledPrice
|
import dev.inmo.tgbotapi.types.payments.LabeledPrice
|
||||||
import dev.inmo.tgbotapi.types.payments.stars.StarTransaction
|
import dev.inmo.tgbotapi.types.payments.stars.StarTransaction
|
||||||
|
import dev.inmo.tgbotapi.types.request.RequestId
|
||||||
import dev.inmo.tgbotapi.utils.bold
|
import dev.inmo.tgbotapi.utils.bold
|
||||||
import dev.inmo.tgbotapi.utils.buildEntities
|
import dev.inmo.tgbotapi.utils.buildEntities
|
||||||
import dev.inmo.tgbotapi.utils.regular
|
import dev.inmo.tgbotapi.utils.regular
|
||||||
|
@ -182,7 +182,7 @@ fun main() {
|
|||||||
val hex = Color.Hex(r, g, b)
|
val hex = Color.Hex(r, g, b)
|
||||||
webApp.setHeaderColor(hex)
|
webApp.setHeaderColor(hex)
|
||||||
(this as? HTMLButtonElement) ?.style ?.backgroundColor = hex.value
|
(this as? HTMLButtonElement) ?.style ?.backgroundColor = hex.value
|
||||||
textContent = "Header color: ${hex.value.uppercase()} (click to change)"
|
textContent = "Header color: ${webApp.headerColor ?.uppercase()} (click to change)"
|
||||||
}
|
}
|
||||||
addEventListener("click", {
|
addEventListener("click", {
|
||||||
updateHeaderColor()
|
updateHeaderColor()
|
||||||
@ -192,6 +192,38 @@ fun main() {
|
|||||||
|
|
||||||
document.body ?.appendElement("p", {})
|
document.body ?.appendElement("p", {})
|
||||||
|
|
||||||
|
document.body ?.appendElement("button") {
|
||||||
|
fun updateBackgroundColor() {
|
||||||
|
val (r, g, b) = Random.nextUBytes(3)
|
||||||
|
val hex = Color.Hex(r, g, b)
|
||||||
|
webApp.setBackgroundColor(hex)
|
||||||
|
(this as? HTMLButtonElement) ?.style ?.backgroundColor = hex.value
|
||||||
|
textContent = "Background color: ${webApp.backgroundColor ?.uppercase()} (click to change)"
|
||||||
|
}
|
||||||
|
addEventListener("click", {
|
||||||
|
updateBackgroundColor()
|
||||||
|
})
|
||||||
|
updateBackgroundColor()
|
||||||
|
} ?: window.alert("Unable to load body")
|
||||||
|
|
||||||
|
document.body ?.appendElement("p", {})
|
||||||
|
|
||||||
|
document.body ?.appendElement("button") {
|
||||||
|
fun updateBottomBarColor() {
|
||||||
|
val (r, g, b) = Random.nextUBytes(3)
|
||||||
|
val hex = Color.Hex(r, g, b)
|
||||||
|
webApp.setBottomBarColor(hex)
|
||||||
|
(this as? HTMLButtonElement) ?.style ?.backgroundColor = hex.value
|
||||||
|
textContent = "Bottom bar color: ${webApp.bottomBarColor ?.uppercase()} (click to change)"
|
||||||
|
}
|
||||||
|
addEventListener("click", {
|
||||||
|
updateBottomBarColor()
|
||||||
|
})
|
||||||
|
updateBottomBarColor()
|
||||||
|
} ?: window.alert("Unable to load body")
|
||||||
|
|
||||||
|
document.body ?.appendElement("p", {})
|
||||||
|
|
||||||
fun Element.updateCloudStorageContent() {
|
fun Element.updateCloudStorageContent() {
|
||||||
clear()
|
clear()
|
||||||
webApp.cloudStorage.getAll {
|
webApp.cloudStorage.getAll {
|
||||||
@ -287,6 +319,16 @@ fun main() {
|
|||||||
}
|
}
|
||||||
show()
|
show()
|
||||||
}
|
}
|
||||||
|
secondaryButton.apply {
|
||||||
|
setText("Secondary button")
|
||||||
|
onClick {
|
||||||
|
document.body ?.log("Secondary button clicked")
|
||||||
|
hapticFeedback.notificationOccurred(
|
||||||
|
HapticFeedbackType.Warning
|
||||||
|
)
|
||||||
|
}
|
||||||
|
show()
|
||||||
|
}
|
||||||
onSettingsButtonClicked {
|
onSettingsButtonClicked {
|
||||||
document.body ?.log("Settings button clicked")
|
document.body ?.log("Settings button clicked")
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ kotlin.daemon.jvmargs=-Xmx3g -Xms500m
|
|||||||
|
|
||||||
|
|
||||||
kotlin_version=2.0.20
|
kotlin_version=2.0.20
|
||||||
telegram_bot_api_version=18.1.0
|
telegram_bot_api_version=18.2.0
|
||||||
micro_utils_version=0.22.2
|
micro_utils_version=0.22.2
|
||||||
serialization_version=1.7.2
|
serialization_version=1.7.2
|
||||||
ktor_version=2.3.12
|
ktor_version=2.3.12
|
||||||
|
Loading…
Reference in New Issue
Block a user