Add askAuthData in consoleLogin
This commit is contained in:
parent
e4bda0a3c7
commit
9bfd22b57d
@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>it.tdlight</groupId>
|
||||
<artifactId>tdlight-java</artifactId>
|
||||
<version>2.7.8.36</version>
|
||||
<version>2.7.8.37</version>
|
||||
</dependency>
|
||||
|
||||
<!-- TDLight natives -->
|
||||
|
@ -43,7 +43,7 @@ public final class Example {
|
||||
client = new SimpleTelegramClient(settings);
|
||||
|
||||
// Configure the authentication info
|
||||
var authenticationData = AuthenticationData.consoleLogin();
|
||||
var authenticationData = AuthenticationData.consoleLogin().askAuthData();
|
||||
|
||||
// Add an example update handler that prints when the bot is started
|
||||
client.addUpdateHandler(TdApi.UpdateAuthorizationState.class, Example::onUpdateAuthorizationState);
|
||||
|
@ -22,7 +22,7 @@ public interface AuthenticationData {
|
||||
return new AuthenticationDataImpl(null, botToken);
|
||||
}
|
||||
|
||||
static AuthenticationData consoleLogin() {
|
||||
static ConsoleInteractiveAuthenticationData consoleLogin() {
|
||||
return new ConsoleInteractiveAuthenticationData();
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,11 @@ final class ConsoleInteractiveAuthenticationData implements AuthenticationData {
|
||||
return botToken;
|
||||
}
|
||||
|
||||
public ConsoleInteractiveAuthenticationData askAuthData() {
|
||||
initializeIfNeeded();
|
||||
return this;
|
||||
}
|
||||
|
||||
private void initializeIfNeeded() {
|
||||
if (initialized) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user