This PR adds support for first-class support for Kotlin into jTelegram as kTelegram with coroutines, extension functions, and a simplified API:
fun main(args: Array<String>) = runBlocking {
val registry = TelegramBotRegistry.builder()
.updateProvider(PollingUpdateProvider.builder().build())
.build()
val bot = registry.registerBot(args[0])
println("${bot.botInfo.username} has started!")
bot.commandRegistry.registerCommand("start", suspendCommand { event, _ ->
try {
event.replyWith(textBuilder {
bold("Welcome to my example bot!"); newLines(2)
+"I love showing off my formatting skills"; newLine()
italics("Like "); link("this", "https://google.com/"); newLine()
+"I can also escape your name: "; escaped(event.message.sender.firstName)
})
event.replyWith("I can also reply directly to your message", true)
println("Yay we did it!")
} catch (e: TelegramException) {
println("Oh no, we failed! Let's complain :(")
e.printStackTrace()
}
})
}```
This PR adds support for first-class support for Kotlin into jTelegram as kTelegram with coroutines, extension functions, and a simplified API: