Add advanced send
This commit is contained in:
parent
33bc58bcb3
commit
17d55599d2
@ -236,7 +236,7 @@ public final class SimpleTelegramClient implements Authenticable {
|
|||||||
* @throws NullPointerException if function is null.
|
* @throws NullPointerException if function is null.
|
||||||
*/
|
*/
|
||||||
public <R extends TdApi.Object> void send(TdApi.Function<R> function, GenericResultHandler<R> resultHandler) {
|
public <R extends TdApi.Object> void send(TdApi.Function<R> function, GenericResultHandler<R> resultHandler) {
|
||||||
this.send(function, resultHandler, null);
|
client.send(function, result -> resultHandler.onResult(Result.of(result)), this::handleResultHandlingException);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -250,10 +250,10 @@ public final class SimpleTelegramClient implements Authenticable {
|
|||||||
*/
|
*/
|
||||||
public <R extends TdApi.Object> void send(TdApi.Function<R> function, GenericResultHandler<R> resultHandler,
|
public <R extends TdApi.Object> void send(TdApi.Function<R> function, GenericResultHandler<R> resultHandler,
|
||||||
ExceptionHandler resultHandlerExceptionHandler) {
|
ExceptionHandler resultHandlerExceptionHandler) {
|
||||||
client.send(function,
|
if (resultHandlerExceptionHandler == null) {
|
||||||
result -> resultHandler.onResult(Result.of(result)),
|
resultHandlerExceptionHandler = this::handleResultHandlingException;
|
||||||
Objects.requireNonNullElse(resultHandlerExceptionHandler, this::handleResultHandlingException)
|
}
|
||||||
);
|
client.send(function, result -> resultHandler.onResult(Result.of(result)), resultHandlerExceptionHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user