Type-safe library for work with Telegram Bot API
Go to file
Renovate Bot 710438489c
Add renovate.json
2020-08-12 20:21:10 +00:00
.github add labeler config for versions 2020-08-03 11:46:38 +06:00
TelegramBotAPI deprecate PositionedInlineQueryResult 2020-08-03 12:15:59 +06:00
TelegramBotAPI-all update publish scripts 2020-05-22 14:03:48 +06:00
TelegramBotAPI-extensions-api new telegramBot 2020-08-10 13:38:19 +06:00
TelegramBotAPI-extensions-utils fix links in toc of extensions readme 2020-08-10 20:02:11 +06:00
badges update look like of kdocs badge 2020-05-23 15:46:49 +06:00
docs by default dokka task will not set up exact folder for docs 2020-06-03 15:42:00 +06:00
gradle/wrapper versions update 2020-08-03 11:41:14 +06:00
resources add hierarchy diagram 2020-06-26 19:11:59 +06:00
.gitignore init 2018-12-26 16:21:52 +08:00
.travis.yml Create .travis.yml 2020-02-19 20:08:15 +06:00
CHANGELOG.md new telegramBot 2020-08-10 13:38:19 +06:00
LICENSE Update LICENSE 2020-02-19 22:29:53 +06:00
README.md Update README.md 2020-07-20 15:15:06 +06:00
TelegramBotAPI.minder add hierarchy diagram 2020-06-26 19:11:59 +06:00
_config.yml Set theme jekyll-theme-cayman 2020-01-06 22:44:23 +06:00
gradle.properties start 0.27.10 2020-08-10 10:45:46 +06:00
gradlew init 2018-12-26 16:21:52 +08:00
gradlew.bat init 2018-12-26 16:21:52 +08:00
renovate.json Add renovate.json 2020-08-12 20:21:10 +00:00
settings.gradle add TelegramBotAPI-all 2020-05-14 14:07:23 +06:00

README.md

TelegramBotAPI

Common info Awesome Kotlin Badge Build Status Small survey
Useful links Chat in Telegram KDocs Examples, Mini tutorial
TelegramBotAPI status Download Maven Central
TelegramBotAPI Extensions status Download Maven Central
TelegramBotAPI Util Extensions status Download Maven Central
TelegramBotAPI All status Download Maven Central

It is a complex of libraries for working with TelegramBotAPI in type-safe and strict way as much as it possible. In the list of this complex currently next projects:

  • TelegramBotAPI - core of library. In fact it is independent library and can be used alone without any additional library
  • TelegramBotAPI Extensions - contains extensions (mostly for RequestsExecutor), which allows to use the core library in more pleasant way
  • TelegramBotAPI Util Extensions - contains extensions for more comfortable work with commands, updates and other different things
  • TelegramBotAPI All - concentration of all previously mentioned libraries

Most part of some specific solves or unuseful moments are describing by official Telegram Bot API.

JavaScript notes

In case if you are want to use this library inside of browser, you will need additional settings (thanks for help to Alexander Nozik):

Gradle build script help
dependencies {
    /* ... */

    implementation "com.github.insanusmokrassar:TelegramBotAPI:$tgbot_api_version"
    implementation "com.github.insanusmokrassar:TelegramBotAPI-extensions-api:$tgbot_api_version" // optional
    implementation "com.github.insanusmokrassar:TelegramBotAPI-extensions-utils:$tgbot_api_version" // optional

    /* Block of dependencies for correct building in browser */
    implementation(npm("fs"))
    implementation(npm("bufferutil"))
    implementation(npm("utf-8-validate"))
    implementation(npm("abort-controller"))
    implementation(npm("text-encoding"))
}

/* ... */

kotlin {
    target {
        browser {
            /* Block for fix of exception in absence of some functionality, https://github.com/ktorio/ktor/issues/1339 */
            dceTask {
                dceOptions {
                    keep("ktor-ktor-io.\$\$importsForInline\$\$.ktor-ktor-io.io.ktor.utils.io")
                }
            }
        }
    }
}

Ok, where should I start?

Libraries hierarchy

In most cases, the most simple way will be to implement TelegramBotAPI All - it contains all necessary tools for comfort usage of this library. If you want to exclude some libraries, you can implement just TelegramBotAPI API Extensions, TelegramBotAPI Util Extensions or even TelegramBotAPI.

If you want to dive deeper in the core of library or develop something for it - welcome to learn more from TelegramBotAPI and our Telegram Chat.

Anyway, all libraries are very typical inside of them. Examples:

  • In TelegramBotAPI common request look like requestsExecutor.execute(SomeRequest())
  • TelegramBotAPI-extensions-api typical syntax look like requestsExecutor.someRequest() (in most cases it would be better to use bot name instead of requestsExecutor)
  • TelegramBotAPI-extensions-utils will look like filter.filterBaseMessageUpdates(chatId).filterExactCommands(Regex("^.*$"))...

Build instruction

If you want to build this project or to contribute, there are several recommendations:

Build

In case if you want to just build project, run next command:

./gradlew clean build

On windows:

gradlew.bat clean build

Publishing for work with your version locally

In case, if you want to work in your other projects using your modification (or some state) of this library, you can use next code:

./gradlew clean build publishToMavenLocal

On windows:

gradlew.bat clean build publishToMavenLocal

But you must remember, that in this case your local maven repo must be the first one from your project retrieving libraries:

repositories {
    mavenLocal() // that must be the first one
    jcenter()
    mavenCentral()
}

Besides, for your own version you can change variable library_version in the file gradle.properties.