update readmes

This commit is contained in:
2026-08-21 15:51:06 +06:00
parent 016400a821
commit ce48393895
104 changed files with 2615 additions and 333 deletions

View File

@@ -1,3 +1,4 @@
import dev.inmo.tgbotapi.types.CustomEmojiId
/** Fixed sample custom emoji used by both the Web App and its bot-assisted route. */
val CustomEmojiIdToSet = CustomEmojiId("5424939566278649034")

View File

@@ -3,4 +3,5 @@ import dev.inmo.tgbotapi.types.request.RequestId
import kotlin.random.Random
import kotlin.random.nextUInt
/** Process-local request ID used when the bot saves its sample managed-bot button. */
val preparedSampleKeyboardRequestId = RequestId(Random.nextUInt().toUShort())

View File

@@ -1,5 +1,11 @@
import kotlinx.serialization.Serializable
/**
* JSON body used by server routes that validate Telegram Web App initialization.
*
* @property data raw `initData` received by the browser Web App.
* @property hash hash exposed by the parsed, unsafe initialization data.
*/
@Serializable
data class WebAppDataWrapper(
val data: String,

View File

@@ -38,6 +38,7 @@ import org.w3c.dom.*
import kotlin.random.Random
import kotlin.random.nextUBytes
/** Appends [text] and a paragraph break to this HTML element. */
fun HTMLElement.log(text: String) {
appendText(text)
appendElement("p", {})
@@ -50,6 +51,10 @@ private object RootStyleSheet : StyleSheet() {
}
}
/**
* Renders the Telegram Web App showcase and connects its controls to the JVM
* server's same-origin validation and bot-helper routes.
*/
@OptIn(ExperimentalUnsignedTypes::class)
fun main() {
console.log("Web app started")

View File

@@ -38,13 +38,13 @@ import kotlinx.serialization.json.Json
import java.io.File
/**
* Accepts two parameters:
* Starts the static Web App server and long-polling bot.
*
* * Telegram Token
* * URL where will be placed
* * Port (default 8080)
*
* Will start the server to share the static (index.html and WebApp.js) on 0.0.0.0:8080
* The first element of [args] must be the bot token and the second the public Web
* App URL used in Telegram buttons. The optional third element is parsed as the
* listening port and defaults to `8080`. Exact `debug` and `testServer` values
* enable diagnostic logging and Telegram's test environment, respectively.
* Production JS output is served when present, otherwise development output.
*/
@OptIn(PreviewFeature::class)
suspend fun main(vararg args: String) {