File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -331,15 +331,12 @@ bool UniversalTelegramBot::getMe() {
331
331
String response = sendGetToTelegram (command); // receive reply from telegram.org
332
332
DynamicJsonDocument doc (maxMessageLength);
333
333
DeserializationError error = deserializeJson (doc, response);
334
- JsonObject obj = doc.as <JsonObject>(); // there is nothing better right now to use obj.containsKey("result")
335
334
closeClient ();
336
335
337
336
if (!error) {
338
- if (obj.containsKey (" result" )) {
339
- String _name = doc[" result" ][" first_name" ];
340
- String _username = doc[" result" ][" username" ];
341
- name = _name;
342
- userName = _username;
337
+ if (doc.containsKey (" result" )) {
338
+ name = doc[" result" ][" first_name" ].as <String>();
339
+ userName = doc[" result" ][" username" ].as <String>();
343
340
return true ;
344
341
}
345
342
}
You can’t perform that action at this time.
0 commit comments