mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2024-11-25 19:48:49 +00:00
add opportunity to use test server in custom bot
This commit is contained in:
parent
ab362e8c3b
commit
21ec50c773
@ -15,6 +15,7 @@ suspend fun main(vararg args: String) {
|
|||||||
val botToken = args.first()
|
val botToken = args.first()
|
||||||
|
|
||||||
val isDebug = args.any { it == "debug" }
|
val isDebug = args.any { it == "debug" }
|
||||||
|
val isTestServer = args.any { it == "testServer" }
|
||||||
|
|
||||||
if (isDebug) {
|
if (isDebug) {
|
||||||
setDefaultKSLog(
|
setDefaultKSLog(
|
||||||
@ -24,11 +25,13 @@ suspend fun main(vararg args: String) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
telegramBotWithBehaviourAndLongPolling(botToken, CoroutineScope(Dispatchers.IO)) {
|
telegramBotWithBehaviourAndLongPolling(botToken, CoroutineScope(Dispatchers.IO), testServer = isTestServer) {
|
||||||
// start here!!
|
// start here!!
|
||||||
val me = getMe()
|
val me = getMe()
|
||||||
println(me)
|
println(me)
|
||||||
|
|
||||||
allUpdatesFlow.subscribeSafelyWithoutExceptions(this) { println(it) }
|
allUpdatesFlow.subscribeSafelyWithoutExceptions(this) {
|
||||||
|
println(it)
|
||||||
|
}
|
||||||
}.second.join()
|
}.second.join()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user