1.0.0 migration preview

This commit is contained in:
2022-05-11 00:23:14 +06:00
parent b740203116
commit 9d42385662
11 changed files with 51 additions and 62 deletions

View File

@@ -29,9 +29,9 @@ fun main() {
addEventListener("click", {
scope.launchSafelyWithoutExceptions {
handleResult({ "Clicked" }) {
HttpClient().post<HttpResponse>("${window.location.origin.removeSuffix("/")}/inline") {
HttpClient().post("${window.location.origin.removeSuffix("/")}/inline") {
parameter(webAppQueryIdField, it)
body = TextContent("Clicked", ContentType.Text.Plain)
setBody(TextContent("Clicked", ContentType.Text.Plain))
document.body ?.log(url.build().toString())
}.coroutineContext.job.join()
}

View File

@@ -13,12 +13,14 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResult
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputTextMessageContent
import dev.inmo.tgbotapi.types.webAppQueryIdField
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
import io.ktor.application.call
import dev.inmo.tgbotapi.utils.PreviewFeature
import io.ktor.http.HttpStatusCode
import io.ktor.http.content.*
import io.ktor.request.receiveText
import io.ktor.response.respond
import io.ktor.routing.*
import io.ktor.server.application.call
import io.ktor.server.http.content.*
import io.ktor.server.request.receiveText
import io.ktor.server.response.respond
import io.ktor.server.routing.post
import io.ktor.server.routing.routing
import kotlinx.coroutines.Dispatchers
import java.io.File
@@ -30,6 +32,7 @@ import java.io.File
*
* Will start the server to share the static (index.html and WebApp.js) on 0.0.0.0:8080
*/
@OptIn(PreviewFeature::class)
suspend fun main(vararg args: String) {
val bot = telegramBot(args.first(), testServer = args.any { it == "testServer" })
createKtorServer(