mirror of
				https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
				synced 2025-11-04 14:10:51 +00:00 
			
		
		
		
	start updating up to 18.2.0
This commit is contained in:
		@@ -182,7 +182,7 @@ fun main() {
 | 
			
		||||
                    val hex = Color.Hex(r, g, b)
 | 
			
		||||
                    webApp.setHeaderColor(hex)
 | 
			
		||||
                    (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", {
 | 
			
		||||
                    updateHeaderColor()
 | 
			
		||||
@@ -192,6 +192,38 @@ fun main() {
 | 
			
		||||
 | 
			
		||||
            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() {
 | 
			
		||||
                clear()
 | 
			
		||||
                webApp.cloudStorage.getAll {
 | 
			
		||||
@@ -287,6 +319,16 @@ fun main() {
 | 
			
		||||
                    }
 | 
			
		||||
                    show()
 | 
			
		||||
                }
 | 
			
		||||
                secondaryButton.apply {
 | 
			
		||||
                    setText("Secondary button")
 | 
			
		||||
                    onClick {
 | 
			
		||||
                        document.body ?.log("Secondary button clicked")
 | 
			
		||||
                        hapticFeedback.notificationOccurred(
 | 
			
		||||
                            HapticFeedbackType.Warning
 | 
			
		||||
                        )
 | 
			
		||||
                    }
 | 
			
		||||
                    show()
 | 
			
		||||
                }
 | 
			
		||||
                onSettingsButtonClicked {
 | 
			
		||||
                    document.body ?.log("Settings button clicked")
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user