An open API service indexing awesome lists of open source software.

https://github.com/tdlight-team/tdlight-java

Complete Bot and Userbot Telegram library based on TDLib
https://github.com/tdlight-team/tdlight-java

java mtproto tdlib tdlib-java telegram telegram-api telegram-bot telegram-bot-api telegram-bot-example telegram-bot-framework telegram-bots telegram-bots-api telegram-java-api telegram-userbot telegrambot

Last synced: 4 days ago
JSON representation

Complete Bot and Userbot Telegram library based on TDLib

Awesome Lists containing this project

README

          


TDLight logo

TDLight Java


Complete Bot and Userbot Telegram library written in Java, based on TDLib



Maven package


Release


JProfiler



## 💻 Supported platforms

**Java versions**: from Java 17 to Java 21+ (Java 8 to 16 is supported if you use the following dependency classifier: `jdk8`)

**Operating systems**: Linux, Windows, MacOS

**CPU architectures**:

- amd64 (Linux, Windows)
- armhf (Linux)
- arm64 (Linux, MacOS)
- ppc64el (Linux)
- riscv64 (linux)

## 📚 Required libraries
- **Linux: OpenSSL1/OpenSSL3, zlib, (libc++ if you use clang)**
- **MacOS: OpenSSL**
- **Windows: [Microsoft Visual C++ Redistributable](https://aka.ms/vs/17/release/vc_redist.x64.exe)**

### Install OpenSSL on macOS

You must install `openssl@3` using the brew package manager , then link openssl
to `/usr/local/opt/openssl`

If you don't know how to do this, type the following commands in your terminal:

```bash
brew install openssl@3
ln -sf /usr/local/Cellar/openssl@3/3.0.0 /usr/local/opt/openssl
```

## 📚 How to use the library

### Setting up the library using Maven

If you are using Maven, edit your `pom.xml` file as below:

```xml



mchv
MCHV Apache Maven Packages
https://mvn.mchv.eu/repository/mchv/






it.tdlight
tdlight-java-bom
VERSION
pom
import




it.tdlight
tdlight-java





it.tdlight
tdlight-natives
linux_amd64_gnu_ssl1




it.tdlight
tdlight-natives
windows_amd64



```

Replace `VERSION` with the latest release version, you can find
it [here](https://github.com/tdlight-team/tdlight-java/releases).

## Setting up the library using Gradle

If you are using Gradle, add the following lines into your `build.gradle` file

```groovy
repositories {
maven { url "https://mvn.mchv.eu/repository/mchv/" }
}
dependencies {
// import the BOM
implementation platform('it.tdlight:tdlight-java-bom:VERSION')

// do not specify the versions on the dependencies below!
implementation group: 'it.tdlight', name: 'tdlight-java' // Java 8 is supported if you use the following dependency classifier: `jdk8`
implementation group: 'it.tdlight', name: 'tdlight-natives', classifier: 'linux_amd64_gnu_ssl1'
// Include other native classifiers, for example linux_amd64_clang_ssl3, macos_arm64, ... -->
}
```

Replace `VERSION` with the latest release version, you can find
it [here](https://github.com/tdlight-team/tdlight-java/releases).

## âš’ Native dependencies

To use TDLight Java you need to include the native libraries, by specifying one of the following classifier for each tdlight-natives dependency:

- `linux_amd64_clang_ssl3`
- `linux_amd64_gnu_ssl1`
- `linux_amd64_gnu_ssl3`
- `linux_arm64_clang_ssl3`
- `linux_arm64_gnu_ssl1`
- `linux_arm64_gnu_ssl3`
- `linux_armhf_gnu_ssl1`
- `linux_armhf_gnu_ssl3`
- `linux_ppc64el_gnu_ssl3`
- `linux_riscv64_gnu_ssl3`
- `windows_amd64`
- `macos_arm64`

Advanced: If you want to use a different precompiled native, please set the java property `it.tdlight.native.workdir`. (Please note that you must build [this](https://github.com/tdlight-team/tdlight-java-natives), you can't put random precompiled tdlib binaries found on the internet)

## Usage

An example on how to use TDLight Java can be found
here: [Example.java](https://github.com/tdlight-team/tdlight-java/blob/master/example/src/main/java/it/tdlight/example/Example.java)

### Advanced usage

If you want to disable the automatic runtime shutdown hook, you should set the property `it.tdlight.enableShutdownHooks`
to `false`

### TDLight methods documentation

[TdApi JavaDoc](https://tdlight-team.github.io/tdlight-docs)

### TDLight extended features

TDLight has some extended features compared to TDLib, that you can see on
the [TDLight official repository](https://github.com/tdlight-team/tdlight#tdlight-extra-features).

## About

### **License**

TDLight is licensed by Andrea Cavalli under the terms of the GNU Lesser General Public License 3

### **Libraries licenses**

JTDLib is licensed by Emily Castellotti under the terms of the GNU Lesser General Public
License 3

TDLib is licensed by Aliaksei Levin and Arseny Smirnov under the terms of the
Boost Software License

OpenSSL is licensed under the terms of Apache License v2

Zlib is licensed under the terms of Zlib license