ktgram is a modern and fully asynchronous framework for Telegram Bot's implementing the Telegram Bot API with kotlin.
- Asynchronous with kotlin coroutines
- Implements Telegram Bot API 7.5
- And many more in the near future!
You can run a simple echo bot with just a few lines of code.
import ru.lavafrai.ktgram.client.Bot
import ru.lavafrai.ktgram.dispatcher.Dispatcher
import ru.lavafrai.ktgram.dispatcher.dsl.text
fun main() {
val bot = Bot("<Your token>")
val dispatcher = bot.dispatcher
dispatcher.routing {
text {
handle {
update.message!!.reply("You said: ${message.text}")
}
}
}
bot.runPolling()
}Add the following to your build.gradle.kts file:
repositories {
maven("https://jitpack.io")
}
dependencies {
implementation("com.github.lavafrai:ktgram:$ktgramVersion")
}- Basic functionality
- State machine
- Middlewares
- Integrated i18n
- Documentation
- Keyboards DSL
- Payments support
- aiogram for idea to implement the same functional framework for kotlin and some architecture solutions.
- kotlin-telegram-bot for some realization ideas.