A Java Wrapper for TDLib/TDLight
Go to file
2020-10-07 15:20:59 +02:00
dependencies Add tdapi generator 2020-10-07 15:20:59 +02:00
jenkins Add tdapi generator 2020-10-07 15:20:59 +02:00
src/main Update pom.xml and LoadLibrary.java 2020-10-07 00:51:26 +02:00
.gitignore Update .gitignore 2020-09-01 22:38:44 +02:00
.gitmodules Add tdapi generator 2020-10-07 15:20:59 +02:00
Jenkinsfile Add tdapi generator 2020-10-07 15:20:59 +02:00
jitpack.yml Updated jitpack.xml 2020-08-06 12:13:31 +02:00
JTDLIB_LICENSE Rewrite ReadMe 2020-08-20 12:18:04 +02:00
LICENSE Added missing license 2018-11-20 18:51:11 +01:00
pom.xml Update pom.xml 2020-10-07 12:15:14 +02:00
README.md Documented TDLight extended features 2020-08-28 21:38:49 +02:00

TDLight Java

A barebone java wrapper for TDLib (and TDLight)

This wrapper gives you direct access to TDLib API in Java.

Requirements

JVM: Oracle JVM or OpenJDK

Java versions: Java 8, 9, 10, 11, 12, 13, 14, 15

Operating system: Windows, Linux

Supported CPU architectures: amd64 (linux, windows), aarch64 (linux)

Required libraries for linux: OpenSSL and zlib

Including TDLight Java in a project

There are two packages of TDLight:

The two packages are compatible, but while TDLight is focused on long term resources usage and speed, TDLib is more focused on stability.

Choose one of the two different TDLight packages and then follow the guide below.

Replace REPLACE_WITH_LATEST_VERSION with the latest version of tdlight, you can find it on the Releases tab on github.

For TDLight Java with optimized TDLight

Maven

Repository:

<repositories>
  <repository>
    <id>mchv</id>
    <name>MCHV Apache Maven Packages</name>
    <url>https://mvn.mchv.eu/repository/mchv/</url>
  </repository>
</repositories>

Dependency:

<dependency>
<groupId>it.tdlight</groupId>
<artifactId>tdlight-java</artifactId>
<version>REPLACE_WITH_LATEST_VERSION</version>
</dependency>

Gradle

repositories {
     maven { url "https://mvn.mchv.eu/repository/mchv/" }
}
dependencies {
     implementation 'it.tdlight:tdlight-java:REPLACE_WITH_LATEST_VERSION'
}

For TDLight Java with official TDLib

Maven

Repository:

<repositories>
  <repository>
    <id>mchv</id>
    <name>MCHV Apache Maven Packages</name>
    <url>https://mvn.mchv.eu/repository/mchv/</url>
  </repository>
</repositories>

Dependency:

<dependency>
<groupId>it.tdlight</groupId>
<artifactId>tdlib-java</artifactId>
<version>REPLACE_WITH_LATEST_VERSION</version>
</dependency>

Gradle

repositories {
     maven { url "https://mvn.mchv.eu/repository/mchv/" }
}
dependencies {
     implementation 'it.tdlight:tdlib-java:REPLACE_WITH_LATEST_VERSION'
}

Usage

Simple initialization of a native TDLib client

import java.io.File;

import it.tdlight.tdlight.Client;
import it.tdlight.tdlight.Init;
import it.tdlight.tdlight.Log;

public class Example {
    public static void main(String[] args) {
        // Initialize TDLight native libraries
        Init.start();

        // Set TDLib log level to 1
        Log.setVerbosityLevel(1);

        // Uncomment this line to print TDLib logs to a file
        // Log.setFilePath("logs" + File.separatorChar + "tdlib.log");
        
        Client client = new Client();
        
        // Initialize the TDLib client
        client.initializeClient();

        // Now you can use the client
    }
}

TDLib methods documentation

TdApi class javadoc

TDLight extended features

TDLight Java with TDLight has some extended features, that you can see on the TDLight official repository.

This features are present only if you use the optimized TDLight package.

About

License

TDLight is licensed by Andrea Cavalli andrea@cavallium.it under the terms of the GNU Lesser General Public License 3

Libraries licenses

JTDlib is licensed by Ernesto Castellotti erny.castell@gmail.com under the terms of the GNU Lesser General Public License 3

TDLib is licensed by Aliaksei Levin levlam@telegram.org and Arseny Smirnov arseny30@gmail.com 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