A Java Wrapper for TDLib/TDLight
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Andrea Cavalli d0992fa7a9 Fix phone number parsing 3 hours ago
.github/workflows Unify pom.xml 3 weeks ago
.media Update README 3 weeks ago
example Fix phone number parsing 3 hours ago
scripts Update deploy_release.sh 10 months ago
src/main Fix phone number parsing 3 hours ago
tdlib Update tdlib 3 days ago
tdlight Update slf4j and disruptor 3 days ago
.gitignore Fix example versioning 10 months ago
.gitmodules Move to github actions 10 months ago
JTDLIB_LICENSE Rewrite ReadMe 1 year ago
LICENSE Added missing license 3 years ago
README.md Configurable shutdown hook 2 weeks ago
jitpack.yml Move to github actions 10 months ago

README.md

TDLight logo

TDLight Java

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

Java CI Release JProfiler

💻 Supported platforms

Java versions: from Java 8 to Java 17

Operating systems: Linux, Windows, MacOS

CPU architectures:

  • i386/x86 (Linux, Windows)
  • amd64/x86_64 (Linux, Windows, OSX)
  • armhf/armv7 (Linux)
  • aarch64/armv8/arm64 (Linux)
  • s390x (Linux)
  • ppc64el/ppc64le (Linux)

Required libraries for Linux: OpenSSL and zlib

Install OpenSSL on macOS

You must install [email protected] 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:

brew install [email protected]
ln -sf /usr/local/Cellar/[email protected]/1.1.1l /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:

<project>
    <repositories>
        
        <!-- Add the following repository -->
        <repository>
            <id>mchv</id>
            <name>MCHV Apache Maven Packages</name>
            <url>https://mvn.mchv.eu/repository/mchv/</url>
        </repository>
        
    </repositories>

    <dependencies>

        <!-- Add the following dependencies -->
        <dependency>
            <groupId>it.tdlight</groupId>
            <artifactId>tdlight-java</artifactId>
            <version>VERSION</version>
        </dependency>
        <dependency>
            <groupId>it.tdlight</groupId>
            <artifactId>tdlight-natives-linux-amd64</artifactId>
            <version>NATIVES_VERSION</version>
        </dependency>
        <!-- Include other native versions that you want, for example for windows, osx, ... -->
        
    </dependencies>
</project>

Replace VERSION with the latest release version, you can find it here.

Replace NATIVES_VERSION with the latest native version. Make sure that you are using the correct natives version for the release that you are using.

Setting up the library using Gradle

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

repositories {
    maven { url "https://mvn.mchv.eu/repository/mchv/" }
}
dependencies {
    implementation 'it.tdlight:tdlight-java:LATEST_VERSION'
    implementation 'it.tdlight:tdlight-natives-linux-amd64:NATIVES_VERSION'
    // Include other native versions that you want, for example for windows, osx, ...
}

Replace VERSION with the latest release version, you can find it here.

Replace NATIVES_VERSION with the latest native version. Make sure that you are using the correct natives version for the release that you are using.

⚒ Native dependencies

To use TDLight Java you need to include one or more native dependencies:

  • tdlight-natives-linux-amd64
  • tdlight-natives-linux-aarch64
  • tdlight-natives-linux-x86
  • tdlight-natives-linux-armv6
  • tdlight-natives-linux-armv7
  • tdlight-natives-linux-ppc64le
  • tdlight-natives-windows-amd64
  • tdlight-natives-osx-amd64

Usage

An example on how to use TDLight Java can be found here: 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

TDLight extended features

TDLight has some extended features compared to TDLib, that you can see on the TDLight official repository.

About

License

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

Libraries licenses

JTDLib is licensed by Ernesto Castellotti [email protected] under the terms of the GNU Lesser General Public License 3

TDLib is licensed by Aliaksei Levin [email protected] and Arseny Smirnov [email protected] 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