From 830a11c9cc273df1b708272db4c69cc212009310 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Tue, 22 Jan 2019 16:47:52 +0100 Subject: [PATCH] Implemented the choice of the first name/last name during registration to prevent the user from blocking telegram with the use of UserClient --- .../java/it/ernytech/tdbot/EasyClient.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/it/ernytech/tdbot/EasyClient.java b/src/main/java/it/ernytech/tdbot/EasyClient.java index 62178a3..a061090 100644 --- a/src/main/java/it/ernytech/tdbot/EasyClient.java +++ b/src/main/java/it/ernytech/tdbot/EasyClient.java @@ -304,11 +304,21 @@ public class EasyClient { } case TdApi.AuthorizationStateWaitCode.CONSTRUCTOR: { - var scanner = new Scanner(System.in); - System.out.print("Insert your code: "); - sendRaw(new TdApi.CheckAuthenticationCode(scanner.nextLine(), "", "")); - System.out.println(); - break; + var scanner = new Scanner(System.in); + System.out.print("Insert your code: "); + TdApi.AuthorizationStateWaitCode authorizationStateWaitCode = (TdApi.AuthorizationStateWaitCode) authorizationState; + TdApi.CheckAuthenticationCode authCodeReply = new TdApi.CheckAuthenticationCode(); + System.out.print("Insert your code: "); + authCodeReply.code = scanner.nextLine(); + if (!authorizationStateWaitCode.isRegistered) { + System.out.print("Insert your first name: "); + authCodeReply.firstName = scanner.nextLine(); + System.out.print("Insert your last name: "); + authCodeReply.lastName = scanner.nextLine(); + } + sendRaw(authCodeReply); + System.out.println(); + break; } case TdApi.AuthorizationStateWaitPassword.CONSTRUCTOR: {