· 7 years ago · Apr 30, 2018, 06:44 PM
1if (update.getMessage().isReply()){
2 Message botMessage = update.getMessage().getReplyToMessage();
3 if (botMessage.hasText()){
4 String text = botMessage.getText();
5 if (text.contains("Reply to this message containing your keys!")){
6 if (registeredUser) {
7 String[] userText = update.getMessage().getText().split("\n\n");
8 if (userText.length==2) {
9 String out = v + " Your binance keys are set!";
10 String apikey = userText[0];
11 String result = splitEnters(apikey);
12
13 SendMessage register = new SendMessage().setChatId(chatid).setText("*"+out.toUpperCase()+"*").enableMarkdown(true);
14 String secretkey = userText[1];
15 String result1 = splitEnters(secretkey);
16 System.out.println("PARTICIPANT "+counter);
17 System.out.println("KEYS: "+result+" "+result1);
18 participants.get(counter).setKeys(result, result1); //sets the keys
19 String error = "";
20
21 try {
22 String account = participants.get(counter).getClient().getAccount().toString();
23 } catch (BinanceApiException e) {
24 e.printStackTrace();
25 participants.get(counter).resetClient();
26 out = x + " incorrect keys found!";
27 register.setText("*"+out.toUpperCase()+"*");
28 error = e.toString();
29 errors.add(new Error(error, LocalDateTime.now()));
30 }
31
32 if (Objects.equals(error, " -1022")) {
33 register.setText(x + " Bad signature. This is an uncommon error. Generate a new set of keys or try again later.");
34 }
35
36 try {
37 sendMessage(register);
38 } catch (TelegramApiException e) {
39 e.printStackTrace();
40 }
41 participants.get(counter).printParticipant();
42 }
43 else {
44 try {
45 sendMessage(new SendMessage().setChatId(chatid).setText(x+" NOT ENOUGH ARGUMENTS!"));
46 } catch (TelegramApiException e) {
47 e.printStackTrace();
48 }
49 }
50 }
51 }
52 }
53 }