All Projects â†’ kotlin-telegram-bot â†’ Kotlin Telegram Bot

kotlin-telegram-bot / Kotlin Telegram Bot

Licence: apache-2.0
🤖 A wrapper for the Telegram Bot API written in Kotlin

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Kotlin Telegram Bot

Botserver
http://telegram.org Bot API Webhooks Framework, for Rubyists
Stars: ✭ 125 (-62.91%)
Mutual labels:  telegram-bot-api, telegram-bot, telegram
checkmk-telegram-notify
Get alerted by Check_MK via Telegram bash script
Stars: ✭ 28 (-91.69%)
Mutual labels:  telegram, telegram-bot, telegram-bot-api
Telegram.bot
.NET Client for Telegram Bot API
Stars: ✭ 1,964 (+482.79%)
Mutual labels:  telegram-bot-api, telegram-bot, telegram
Vk To Telegram Bot
Bot for auto-reposting posts from VK to Telegram channel
Stars: ✭ 103 (-69.44%)
Mutual labels:  telegram-bot-api, telegram-bot, telegram
Telegrammer
Telegram Bot - written with Swift 5.2 / NIO, supports Linux, macOS
Stars: ✭ 248 (-26.41%)
Mutual labels:  telegram-bot-api, telegram-bot, telegram
Zanzara
Asynchronous PHP Telegram Bot Framework built on top of ReactPHP
Stars: ✭ 107 (-68.25%)
Mutual labels:  telegram-bot-api, telegram-bot, telegram
Telegram Bot Sdk
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
Stars: ✭ 2,212 (+556.38%)
Mutual labels:  telegram-bot-api, telegram-bot, telegram
Libtelegram
Fast, efficient, header-only C++ Telegram bot API library using polling or FastCGI
Stars: ✭ 88 (-73.89%)
Mutual labels:  telegram-bot-api, telegram-bot, telegram
Python Telegram
Python client for the Telegram's tdlib
Stars: ✭ 246 (-27%)
Mutual labels:  telegram-bot-api, telegram-bot, telegram
Rastreiobot
Telegram Bot @RastreioBot
Stars: ✭ 196 (-41.84%)
Mutual labels:  telegram-bot-api, telegram-bot, telegram
Ex gram
Telegram Bot API low level API and framework
Stars: ✭ 103 (-69.44%)
Mutual labels:  telegram-bot-api, hacktoberfest, telegram
Telegram
Telegram Bot API Wrapper for Scala
Stars: ✭ 310 (-8.01%)
Mutual labels:  telegram-bot-api, telegram-bot, telegram
Integram
Integrate Telegram into your workflow – Trello, Gitlab, Bitbucket and other bots
Stars: ✭ 1,365 (+305.04%)
Mutual labels:  telegram-bot-api, telegram-bot, telegram
Bot Api Base
Clear and simple Telegram bot API
Stars: ✭ 122 (-63.8%)
Mutual labels:  telegram-bot-api, telegram-bot, telegram
Telebot.nim
Async client for Telegram Bot API in pure Nim [Bot API 5.1]
Stars: ✭ 93 (-72.4%)
Mutual labels:  telegram-bot-api, telegram-bot, telegram
Teledart
A Dart library interfacing with the latest Telegram Bot API.
Stars: ✭ 142 (-57.86%)
Mutual labels:  telegram-bot-api, telegram-bot, telegram
Telebot
The easy way to write Telegram bots in Node.js
Stars: ✭ 1,096 (+225.22%)
Mutual labels:  telegram-bot-api, telegram-bot, telegram
Telegram Spring Boot Starter
Telegram Bot API Spring Boot Starter
Stars: ✭ 79 (-76.56%)
Mutual labels:  telegram-bot-api, telegram-bot, telegram
Java Telegram Bot Tutorial
Java Telegram Bot Tutorial. Feel free to submit issue if you found a mistake.
Stars: ✭ 165 (-51.04%)
Mutual labels:  telegram-bot-api, telegram-bot, telegram
webhook-aiogram-heroku
A sample telegram bot made with aiogram, that fetches updates using the web-hook connection. Can be easily deployed to Heroku.
Stars: ✭ 36 (-89.32%)
Mutual labels:  telegram, telegram-bot, telegram-bot-api

Kotlin Telegram Bot

Build Status Release ktlint

A wrapper for the Telegram Bot API written in Kotlin.

Usage

Creating a bot instance is really simple:

fun main() {
    val bot = bot {
        token = "YOUR_API_KEY"
    }
}

Now lets poll telegram API and route all text updates:

fun main() {
    val bot = bot {
        token = "YOUR_API_KEY"
        dispatch {
            text {
                bot.sendMessage(ChatId.fromId(message.chat.id), text = text)
            }
        }
    }
    bot.startPolling()
}

Want to route commands?:

fun main() {
    val bot = bot {
        token = "YOUR_API_KEY"
        dispatch {
            command("start") {
                val result = bot.sendMessage(chatId = ChatId.fromId(message.chat.id), text = "Hi there!")
                result.fold({
                    // do something here with the response
                },{
                    // do something with the error 
                })
            }
        }
    }
    bot.startPolling()
}

Examples

Take a look at the examples folder.

There are several samples:

  • A simple echo bot
  • A more complex sample with commands, filter, reply markup keyboard and more
  • A sample getting updates through Telegram's webhook using a Netty server
  • An example bot sending polls and listening to poll answers

Download

  • Add the JitPack repository to your root build.gradle file:
repositories {
    maven { url "https://jitpack.io" }
}
  • Add the code to your module's build.gradle file:
dependencies {
    implementation 'io.github.kotlin-telegram-bot.kotlin-telegram-bot:telegram:x.y.z'
}

Detailed documentation

  1. Getting updates
  2. Polls
  3. Dice
  4. Logging
  5. Games

Contributing

  1. Fork and clone the repo
  2. Run ./gradlew ktlintFormat
  3. Run ./gradlew build to see if tests, ktlint and abi checks pass.
  4. Commit and push your changes
  5. Submit a pull request to get your changes reviewed

Thanks

  • Big part of the architecture of this project is inspired by python-telegram-bot, check it out!
  • Some awesome kotlin ninja techniques were grabbed from Fuel.

License

Kotlin Telegram Bot is under the Apache 2.0 license. See the LICENSE for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].