"Batteries Included" Telegram Bot API wrapper for Scala
- Fully asynchronous
- spray.io powered.
- Declarative DSL for simple bot features
- Strongly-typed
- getMe
- sendMessage
- getUpdates
- forwardMessage
- sendPhoto
- sendAudio
- sendVoice (coming soon)
- sendDocument
- sendSticker
- sendVideo (coming soon)
- sendLocation
- sendChatAction
- getUserProfilePhotos
- getUpdates
- Custom keyboard markups
- Webhook with a SSL reverse proxy
- Built-in Webhook support
- Better error handling
- Documentation
Check reference.conf for configuration.
There is no release yet; project still lack too much improvement. Wait for updates.
object GreeterBot extends TelegramBot with Polling with Declarative {
on("/start") { implicit message: Message =>
reply("Welcome")
}
}
object GreeterBot extends TelegramBot with Polling with Declarative {
on("/start") { implicit message: Message =>
message.from match {
case Some(user) => reply("Welcome, " + user.firstName)
case _ =>
}
}
}
object GreeterBot extends TelegramBot with Polling with Declarative {
on("/start") { implicit message: Message =>
sendPhoto("~/image.jpg")
}
}
object GreeterBot extends TelegramBot with Polling with Declarative {
when { message =>
message.photo match {
case Some(photo) => true
case None => false
}
} perform { implicit message =>
reply("Nice Smile!")
}
}
object GreeterBot extends TelegramBot with Polling with Declarative {
every(1 hours) {
sendTo("Ping!", 31415926535)
}
}
object TestBot extends TelegramBot with Polling with Declarative {
sendTo("test", 1093654812) map {
case Right(message) =>
println(message);
case Left(error) if error.code == 403 =>
println("No, we are not allowed to send messages to this chat");
case Left(error) if error.code == 400 =>
println("No, chat doesn't exists");
}
}
on("Welcome") { implicit message =>
typing; reply("typed.")
}
}