Update README

This commit is contained in:
Andrea Cavalli 2023-05-15 00:10:23 +02:00
parent 9a1c284d69
commit 98273f1d47
3 changed files with 35 additions and 26 deletions

View File

@ -15,21 +15,19 @@
## 💻 Supported platforms ## 💻 Supported platforms
**Java versions**: from Java 17 to Java 19+ (Java 8 is supported if you use the following dependency classifier: `jdk8`) **Java versions**: from Java 17 to Java 19+ (Java 8 to 16 is supported if you use the following dependency classifier: `jdk8`)
**Operating systems**: Linux, Windows, MacOS **Operating systems**: Linux, Windows, MacOS
**CPU architectures**: **CPU architectures**:
- i386/x86 (Linux, Windows) - amd64/x86_64 (Linux, Windows, MacOS)
- amd64/x86_64 (Linux, Windows, OSX)
- armhf/armv7 (Linux) - armhf/armv7 (Linux)
- aarch64/armv8/arm64 (Linux) - aarch64/armv8/arm64 (Linux)
- s390x (Linux)
- ppc64el/ppc64le (Linux) - ppc64el/ppc64le (Linux)
## 📚 Required libraries ## 📚 Required libraries
- **Linux: OpenSSL, zlib** - **Linux: libc++, OpenSSL1/OpenSSL3, zlib**
- **MacOS: OpenSSL** - **MacOS: OpenSSL**
- **Windows: [Microsoft Visual C++ Redistributable](https://aka.ms/vs/17/release/vc_redist.x64.exe)** - **Windows: [Microsoft Visual C++ Redistributable](https://aka.ms/vs/17/release/vc_redist.x64.exe)**
@ -84,15 +82,26 @@ If you are using Maven, edit your `pom.xml` file as below:
<!-- Add the following dependencies --> <!-- Add the following dependencies -->
<dependency> <dependency>
<groupId>it.tdlight</groupId> <groupId>it.tdlight</groupId>
<artifactId>tdlight-java</artifactId> <!-- Java 8 is supported if you use the following dependency classifier: <classifier>jdk8</classifier> --> <artifactId>tdlight-java</artifactId>
<!-- Java 8 is supported if you use the following dependency classifier: <classifier>jdk8</classifier> -->
<!-- don't specify the version here --> <!-- don't specify the version here -->
</dependency> </dependency>
<!-- Example linux amd64 ssl1 natives -->
<dependency> <dependency>
<groupId>it.tdlight</groupId> <groupId>it.tdlight</groupId>
<artifactId>tdlight-natives-linux-amd64</artifactId> <artifactId>tdlight-natives</artifactId>
<classifier>linux_amd64_ssl1</classifier>
<!-- don't specify the version here --> <!-- don't specify the version here -->
</dependency> </dependency>
<!-- Include other native versions that you want, for example for windows, osx, ... --> <!-- Example windows amd64 natives -->
<dependency>
<groupId>it.tdlight</groupId>
<artifactId>tdlight-natives</artifactId>
<classifier>windows_amd64</classifier>
<!-- don't specify the version here -->
</dependency>
<!-- ... -->
<!-- Include other native classifiers, for example linux_amd64_ssl3, macos_amd64, ... -->
</dependencies> </dependencies>
</project> </project>
@ -114,9 +123,9 @@ dependencies {
implementation platform('it.tdlight:tdlight-java-bom:VERSION') implementation platform('it.tdlight:tdlight-java-bom:VERSION')
// do not specify the versions on the dependencies below! // do not specify the versions on the dependencies below!
implementation 'it.tdlight:tdlight-java' // Java 8 is supported if you use the following dependency classifier: `jdk8` implementation 'it.tdlight:tdlight-java:VERSION' // Java 8 is supported if you use the following dependency classifier: `jdk8`
implementation 'it.tdlight:tdlight-natives-linux-amd64' implementation 'it.tdlight:tdlight-natives:VERSION:linux_amd64_ssl1'
// Include other native versions that you want, for example for windows, osx, ... // Include other native classifiers, for example linux_amd64_ssl3, macos_amd64, ... -->
} }
``` ```
@ -125,16 +134,15 @@ it [here](https://github.com/tdlight-team/tdlight-java/releases).
## ⚒ Native dependencies ## ⚒ Native dependencies
To use TDLight Java you need to include one or more 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:
- `tdlight-natives-linux-amd64` - `linux_amd64_ssl1`
- `tdlight-natives-linux-aarch64` - `linux_amd64_ssl3`
- `tdlight-natives-linux-x86` - `linux_arm64_ssl1`
- `tdlight-natives-linux-armhf` - `linux_arm64_ssl3`
- `tdlight-natives-linux-ppc64le` - `linux_ppc64le_ssl3`
- `tdlight-natives-linux-s390x` - `windows_amd64`
- `tdlight-natives-windows-amd64` - `macos_amd64`
- `tdlight-natives-osx-amd64`
## Usage ## Usage

View File

@ -44,8 +44,6 @@ public final class Example {
// Configure the client // Configure the client
TDLibSettings settings = TDLibSettings.create(apiToken); TDLibSettings settings = TDLibSettings.create(apiToken);
// This is an example, remove this line to use the real telegram datacenters!
settings.setUseTestDatacenter(true);
// Configure the session directory // Configure the session directory
Path sessionPath = Paths.get("example-tdlight-session"); Path sessionPath = Paths.get("example-tdlight-session");
@ -56,7 +54,10 @@ public final class Example {
SimpleTelegramClientBuilder clientBuilder = clientFactory.builder(settings); SimpleTelegramClientBuilder clientBuilder = clientFactory.builder(settings);
// Configure the authentication info // Configure the authentication info
SimpleAuthenticationSupplier<?> authenticationData = AuthenticationSupplier.testUser(7381); // Replace with AuthenticationSupplier.consoleLogin(), or .user(xxx), or .bot(xxx); // Replace with AuthenticationSupplier.consoleLogin(), or .user(xxx), or .bot(xxx);
SimpleAuthenticationSupplier<?> authenticationData = AuthenticationSupplier.testUser(7381);
// This is an example, remove this line to use the real telegram datacenters!
settings.setUseTestDatacenter(true);
// Add an example update handler that prints when the bot is started // Add an example update handler that prints when the bot is started
clientBuilder.addUpdateHandler(TdApi.UpdateAuthorizationState.class, Example::onUpdateAuthorizationState); clientBuilder.addUpdateHandler(TdApi.UpdateAuthorizationState.class, Example::onUpdateAuthorizationState);

View File

@ -4,7 +4,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://logging.apache.org/log4j/2.0/config xsi:schemaLocation="http://logging.apache.org/log4j/2.0/config
https://raw.githubusercontent.com/apache/logging-log4j2/log4j-2.16.0/log4j-core/src/main/resources/Log4j-config.xsd" https://raw.githubusercontent.com/apache/logging-log4j2/log4j-2.16.0/log4j-core/src/main/resources/Log4j-config.xsd"
status="INFO"> status="DEBUG">
<Appenders> <Appenders>
<Console name="Console" target="SYSTEM_OUT"> <Console name="Console" target="SYSTEM_OUT">
<PatternLayout <PatternLayout
@ -13,8 +13,8 @@
</Appenders> </Appenders>
<Loggers> <Loggers>
<Logger name="it.tdlight.TDLight" level="ERROR" additivity="false" /> <Logger name="it.tdlight.TDLight" level="WARN" additivity="false" />
<Root level="INFO"> <Root level="DEBUG">
<AppenderRef ref="Console"/> <AppenderRef ref="Console"/>
</Root> </Root>
</Loggers> </Loggers>