mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2024-12-22 00:27:19 +00:00
commit
88697fb5a6
@ -1,4 +1,9 @@
|
||||
import dev.inmo.kslog.common.KSLog
|
||||
import dev.inmo.kslog.common.LogLevel
|
||||
import dev.inmo.kslog.common.defaultMessageFormatter
|
||||
import dev.inmo.kslog.common.setDefaultKSLog
|
||||
import dev.inmo.micro_utils.coroutines.firstOf
|
||||
import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions
|
||||
import dev.inmo.micro_utils.fsm.common.State
|
||||
import dev.inmo.tgbotapi.bot.ktor.telegramBot
|
||||
import dev.inmo.tgbotapi.extensions.api.bot.setMyCommands
|
||||
@ -50,6 +55,16 @@ sealed interface UserRetrievingStep : State {
|
||||
suspend fun main(args: Array<String>) {
|
||||
val botToken = args.first()
|
||||
|
||||
val isDebug = args.getOrNull(2) == "debug"
|
||||
|
||||
if (isDebug) {
|
||||
setDefaultKSLog(
|
||||
KSLog { level: LogLevel, tag: String?, message: Any, throwable: Throwable? ->
|
||||
println(defaultMessageFormatter(level, tag, message, throwable))
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
val bot = telegramBot(botToken)
|
||||
|
||||
val allowedAdmin = ChatId(args[1].toLong())
|
||||
@ -517,5 +532,9 @@ suspend fun main(args: Array<String>) {
|
||||
BotCommand("rights_in_channel", "Trigger granular keyboard. Use with reply to user"),
|
||||
scope = BotCommandScope.AllGroupChats
|
||||
)
|
||||
|
||||
allUpdatesFlow.subscribeSafelyWithoutExceptions(this) {
|
||||
println(it)
|
||||
}
|
||||
}.join()
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx2344m
|
||||
|
||||
|
||||
kotlin_version=1.9.22
|
||||
telegram_bot_api_version=10.0.0
|
||||
micro_utils_version=0.20.26
|
||||
telegram_bot_api_version=10.1.0
|
||||
micro_utils_version=0.20.34
|
||||
serialization_version=1.6.2
|
||||
ktor_version=2.3.7
|
||||
ktor_version=2.3.8
|
||||
|
Loading…
Reference in New Issue
Block a user