TelegramBotAPI-examples/GetMeBot/src/main/kotlin/GetMeBot.kt

25 lines
796 B
Kotlin
Raw Normal View History

2023-11-25 06:44:05 +00:00
import dev.inmo.kslog.common.KSLog
import dev.inmo.kslog.common.LogLevel
import dev.inmo.kslog.common.defaultMessageFormatter
import dev.inmo.kslog.common.filter.filtered
2023-11-25 06:57:11 +00:00
import dev.inmo.kslog.common.setDefaultKSLog
2022-05-10 18:23:14 +00:00
import dev.inmo.tgbotapi.bot.ktor.telegramBot
2020-10-04 11:32:50 +00:00
import dev.inmo.tgbotapi.extensions.api.bot.getMe
2023-11-25 06:44:05 +00:00
import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog
2020-06-02 15:48:07 +00:00
/**
* This is one of the most easiest bot - it will just print information about itself
*/
suspend fun main(vararg args: String) {
val botToken = args.first()
2023-11-25 06:57:11 +00:00
setDefaultKSLog(
KSLog { level: LogLevel, tag: String?, message: Any, throwable: Throwable? ->
println(defaultMessageFormatter(level, tag, message, throwable))
}
)
2020-06-02 15:48:07 +00:00
val bot = telegramBot(botToken)
println(bot.getMe())
2022-05-10 18:23:14 +00:00
}