- Update Bot API to 6.2
- fix InputMedia(#54) and BotCommandScope (de)serialization
InlineQueryResult
serialization fix
- Update Bot API to 6.1
- Common
ChatMember
status
anduser
fields - fixed
Owner
andAdministrator
serialization
- fixed
ChatId
serialization
- fixed
PassportElementError
serialization - fixed
ChatMember
serialization
- added
SendingDocument
abstraction - chain methods marked as
suspend
- Update Bot API to 6.0
- Brings major changes like
- moving from
future
pattern to Kotlin Coroutines - package changed from com.elbekD.* to com.elbekd.*
- added
ChatId
sealed class and extension methods forString
andInt
object to convert them toChatId
instance - added separate interfaces for some standalone APIs.
TelegramApi
extends them all
- moving from
- Fix issue
- Update Bot API to 5.0
- Migrate to Kotlin 1.4.20
- Support ByteArray type for file sending
- Support API 4.9 changes
- Added some extension functions to work with the keyboard. See sources for details
- Apply suggestion from issue #24 for editTextMessage; changed argument order in createNewStickerSet and addStickerToSet
- Apply suggestion from issue #24
- Updated API to 4.8
- Updated API to 4.7
Added new feature - Chain. It is common case when you need to ask the user several
questions sequentially and process user errors. Now you can create such chains easily.
Sea the example below. Do not forget to call build()
method at the end =)
fun main() {
val token = "<TOKEN>"
val username = "<BOT USERNAME>"
val bot = Bot.createPolling(username, token)
bot.chain("/start") { msg -> bot.sendMessage(msg.chat.id, "Hi! What is your name?") }
.then { msg -> bot.sendMessage(msg.chat.id, "Nice to meet you, ${msg.text}! Send something to me") }
.then { msg -> bot.sendMessage(msg.chat.id, "Fine! See you soon") }
.build()
bot.chain(
label = "location_chain",
predicate = { msg -> msg.location != null },
action = { msg ->
bot.sendMessage(
msg.chat.id,
"Fine, u've sent me a location. Is this where you want to order a taxi?(yes|no)"
)
})
.then("answer_choice") { msg ->
when (msg.text) {
"yes" -> bot.jumpToAndFire("order_taxi", msg)
"no" -> bot.jumpToAndFire("cancel_ordering", msg)
else -> {
bot.sendMessage(msg.chat.id, "Oops, I don't understand you. Just answer yes or no?")
bot.jumpTo("answer_choice", msg)
}
}
}
.then("order_taxi", isTerminal = true) { msg ->
bot.sendMessage(msg.chat.id, "Fine! Taxi is coming")
}
.then("cancel_ordering", isTerminal = true) { msg ->
bot.sendMessage(msg.chat.id, "Ok! See you next time")
}
.build()
bot.start()
}