mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2025-12-08 15:25:38 +00:00
Compare commits
7 Commits
0.38.16
...
bf0c6497fe
| Author | SHA1 | Date | |
|---|---|---|---|
| bf0c6497fe | |||
|
|
71a047f867 | ||
| 2ae3e1165d | |||
| 9a5d02512b | |||
| dd2c528006 | |||
| 1c16a9f868 | |||
| 00c3aba12b |
17
WebApp/README.md
Normal file
17
WebApp/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# WebApp
|
||||
|
||||
Here you may find simple example of `WebApp`. For work of this example you will need one of two things:
|
||||
|
||||
* Your own domain with SSL (letsencrypt is okay)
|
||||
* Test account in telegram
|
||||
|
||||
What is there in this module:
|
||||
|
||||
* JVM part of this example is a server with simple static webapp sharing and bot which just gives the webapp button to open webapp
|
||||
* JS part is the WebApp with one button and reacting to chaged user theme and app viewport
|
||||
|
||||
## How to run
|
||||
|
||||
```kotlin
|
||||
./gradlew run --args="TOKEN WEB_APP_ADDRESS"
|
||||
```
|
||||
@@ -5,11 +5,9 @@ import dev.inmo.tgbotapi.extensions.api.send.*
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.*
|
||||
import dev.inmo.tgbotapi.extensions.utils.types.buttons.*
|
||||
import io.ktor.application.call
|
||||
import io.ktor.http.content.files
|
||||
import io.ktor.http.content.static
|
||||
import io.ktor.routing.get
|
||||
import io.ktor.routing.routing
|
||||
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
|
||||
import io.ktor.http.content.*
|
||||
import io.ktor.routing.*
|
||||
import io.ktor.server.tomcat.Tomcat
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import java.io.File
|
||||
@@ -45,12 +43,13 @@ suspend fun main(vararg args: String) {
|
||||
onCommand("start") {
|
||||
reply(
|
||||
it,
|
||||
"Button:",
|
||||
replyMarkup = inlineKeyboard {
|
||||
"Button",
|
||||
replyMarkup = replyKeyboard {
|
||||
row {
|
||||
webAppButton("Open", args[1])
|
||||
webAppButton("Open WebApp", WebAppInfo(args[1]))
|
||||
}
|
||||
}
|
||||
|
||||
)
|
||||
}
|
||||
allUpdatesFlow.subscribeSafelyWithoutExceptions(this) {
|
||||
|
||||
@@ -3,6 +3,6 @@ org.gradle.parallel=true
|
||||
|
||||
|
||||
kotlin_version=1.6.10
|
||||
telegram_bot_api_version=0.38.16
|
||||
telegram_bot_api_version=0.38.19
|
||||
micro_utils_version=0.9.24
|
||||
ktor_version=1.6.8
|
||||
|
||||
Reference in New Issue
Block a user