telegram-bot-kit

Introduction: Idiomatic, fluent and type-safe Kotlin bindings for Telegram Bot API
More: Author   ReportBugs   
Tags:
Update-Add-FLAMIN-

Maven Central License: MIT Gradle build

Idiomatic, fluent and type-safe Kotlin bindings for Telegram Bot API.

val poller = TelegramBotApiPoller(TelegramBotApiClient(botApiToken))
poller.start(
    TelegramBotUpdateListener(
        onMessage = { message ->
            message.reply(
                text = "Hello, *${message.from?.firstName ?: "stranger"}*!",
                parseMode = ParseMode.MARKDOWN,
                replyMarkup = inlineKeyboard {
                    buttonLink("Telegram", "https://telegram.org")
                    row {
                        button("Bot", "bot")
                        button("API", "api")
                    }
                }
            )
        },
        onCallbackQuery = { callbackQuery ->
            when (callbackQuery.data) {
                "bot" -> callbackQuery.answer("🤖")
                "api" -> callbackQuery.answer("🚀")
                else -> callbackQuery.answer("🤷")
            }
        }
    )
)

Usage

Using with Gradle for JVM projects kotlin dependencies { implementation("me.alllex.telegram.botkit:tbot-api-jvm:0.9.0") }
Using with Maven for JVM projects xml <dependency> <groupId>me.alllex.telegram.botkit</groupId> <artifactId>tbot-api-jvm</artifactId> <version>0.9.0</version> </dependency>

Compatibility

The bindings are generated directly from the source-of-truth Bot API spec.

Telegram Bot API tbot-api library
9.0 0.9.0
7.9 0.8.0
7.7 0.7.0
7.4 0.6.1
7.3 0.5.0
6.9 0.4.0
tbot-api library Requirement
0.9.0 Kotlin 2.0.0, JVM 11
0.4.0 Kotlin 1.9.0, JVM 8

Developing

Updating API to a new version of Telegram Bot API

./gradlew rollNextApi check

Roadmap

Alpha

  • [ ] Error handling

Beta

  • [ ] Cleaner package structure
  • [ ] Strict library member visibility
  • [ ] Forward compatibility: published versions of the library should not break with new API versions (union types and enums)
  • [ ] Support for integration tests bots

License

Distributed under the MIT License. See LICENSE for more information.

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools