Merge pull request #253 from InsanusMokrassar/10.1.0

10.1.0
This commit is contained in:
InsanusMokrassar 2024-02-17 13:38:13 +06:00 committed by GitHub
commit 88697fb5a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 3 deletions

View File

@ -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.firstOf
import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions
import dev.inmo.micro_utils.fsm.common.State import dev.inmo.micro_utils.fsm.common.State
import dev.inmo.tgbotapi.bot.ktor.telegramBot import dev.inmo.tgbotapi.bot.ktor.telegramBot
import dev.inmo.tgbotapi.extensions.api.bot.setMyCommands import dev.inmo.tgbotapi.extensions.api.bot.setMyCommands
@ -50,6 +55,16 @@ sealed interface UserRetrievingStep : State {
suspend fun main(args: Array<String>) { suspend fun main(args: Array<String>) {
val botToken = args.first() 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 bot = telegramBot(botToken)
val allowedAdmin = ChatId(args[1].toLong()) 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"), BotCommand("rights_in_channel", "Trigger granular keyboard. Use with reply to user"),
scope = BotCommandScope.AllGroupChats scope = BotCommandScope.AllGroupChats
) )
allUpdatesFlow.subscribeSafelyWithoutExceptions(this) {
println(it)
}
}.join() }.join()
} }

View File

@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx2344m
kotlin_version=1.9.22 kotlin_version=1.9.22
telegram_bot_api_version=10.0.0 telegram_bot_api_version=10.1.0
micro_utils_version=0.20.26 micro_utils_version=0.20.34
serialization_version=1.6.2 serialization_version=1.6.2
ktor_version=2.3.7 ktor_version=2.3.8