Compare commits

...

7 Commits

Author SHA1 Message Date
bf0c6497fe Merge pull request #101 from Akkihi/master
sendData does not work with inlineKeyboard
2022-05-03 23:57:07 +06:00
akkkihi
71a047f867 sendData does not work with inlineKeyboard 2022-05-03 17:55:08 +04:00
2ae3e1165d Update gradle.properties 2022-05-03 15:55:27 +06:00
9a5d02512b Update gradle.properties 2022-05-02 14:28:05 +06:00
dd2c528006 Update gradle.properties 2022-05-01 18:42:09 +06:00
1c16a9f868 Create README.md 2022-04-30 08:47:35 +06:00
00c3aba12b Merge pull request #97 from InsanusMokrassar/0.38.16
0.38.16
2022-04-30 08:40:17 +06:00
3 changed files with 25 additions and 9 deletions

17
WebApp/README.md Normal file
View 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"
```

View File

@@ -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) {

View File

@@ -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