.github | ||
badges | ||
docs | ||
gradle/wrapper | ||
resources | ||
tgbotapi | ||
tgbotapi.core | ||
tgbotapi.extensions.api | ||
tgbotapi.extensions.behaviour_builder | ||
tgbotapi.extensions.utils | ||
_config.yml | ||
.gitignore | ||
.travis.yml | ||
build.gradle | ||
changelog_info_retriever | ||
CHANGELOG.md | ||
CONTRIBUTING.md | ||
gradle.properties | ||
gradlew | ||
gradlew.bat | ||
LICENSE | ||
README.md | ||
renovate.json | ||
settings.gradle | ||
TelegramBotAPI.minder |
Participate in our common survey ☺
TelegramBotAPI
I do not wanna read a lot, just give me my bot
You can simply use this template (and button Use template) to get your copy of bot and start to code.
P.S. Do not forget to look into our minidocs and kdocsCommon info | Small survey |
---|---|
Useful links | Examples, Mini tutorial |
TelegramBotAPI Core status | |
TelegramBotAPI API Extensions status | |
TelegramBotAPI Util Extensions status | |
TelegramBotAPI Behaviour Builder Extensions status | |
TelegramBotAPI All status |
At the time of publication of version 0.28.0
there are errors in serialization plugins like
kotlinx.serialization#1004. It is possible, that both JVM
and JS version may work improperly in some cases with kotlinx.serialization
version 1.0.0-RC
What is it?
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 - core of library. In fact it is independent library and can be used alone without any additional library
- TelegramBotAPI API 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 Behaviour Builder Extensions - builder for step-by-step handling of bot behaviour in more comfortable manner
- TelegramBotAPI - concentration of all previously mentioned libraries
Most part of some specific solves or unuseful moments are describing by official Telegram Bot API.
JavaScript notes
Versions before 0.28.0
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 (for versions before 0.28.0)
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?
In most cases, the most simple way will be to implement TelegramBotAPI - it contains all necessary tools for comfort usage of this library. If you want to exclude some libraries, you can implement just TelegramBotAPI BehaviourBuilder Extensions, TelegramBotAPI API Extensions, TelegramBotAPI Util Extensions or even TelegramBotAPI Core.
If you want to dive deeper in the core of library or develop something for it - welcome to learn more from TelegramBotAPI Core and our Telegram Chat.
Anyway, all libraries are very typical inside of them. Examples:
- In
TelegramBotAPI
common request look likerequestsExecutor.execute(SomeRequest())
tgbotapi.extensions.api
typical syntax look likerequestsExecutor.someRequest()
(in most cases it would be better to usebot
name instead ofrequestsExecutor
)tgbotapi.extensions.utils
will look likefilter.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.