Fix phone number parsing

This commit is contained in:
Andrea Cavalli 2021-10-20 02:13:24 +02:00
parent 73d9d977cc
commit d0992fa7a9
2 changed files with 2 additions and 6 deletions

View File

@ -25,7 +25,7 @@
<dependency>
<groupId>it.tdlight</groupId>
<artifactId>tdlight-java</artifactId>
<version>2.7.8.20</version>
<version>2.7.8.21</version>
</dependency>
<!-- TDLight natives -->

View File

@ -98,11 +98,7 @@ final class ConsoleInteractiveAuthenticationData implements AuthenticationData {
phoneNumber = ScannerUtils.askParameter("login", "Please type your phone number");
} while (phoneNumber.length() < 3);
long phoneNumberLong = Long.parseLong(phoneNumber.chars().filter(Character::isDigit).boxed().collect(Collector.of(
StringBuilder::new,
StringBuilder::append,
StringBuilder::append,
StringBuilder::toString)));
long phoneNumberLong = Long.parseLong(phoneNumber.replaceAll("[\\D]", ""));
this.isBot = false;
this.phoneNumber = phoneNumberLong;