diff --git a/src/UniversalTelegramBot.cpp b/src/UniversalTelegramBot.cpp index 48c13af..e416941 100644 --- a/src/UniversalTelegramBot.cpp +++ b/src/UniversalTelegramBot.cpp @@ -62,7 +62,7 @@ String UniversalTelegramBot::sendGetToTelegram(String command) { client->println("GET /"+command); now=millis(); avail=false; - while (millis() - now < longPoll * 1000 + 1500) { + while (millis() - now < longPoll * 1000 + waitForResponse) { while (client->available()) { char c = client->read(); //Serial.write(c); @@ -125,7 +125,7 @@ String UniversalTelegramBot::sendPostToTelegram(String command, JsonObject& payl responseReceived=false; bool finishedHeaders = false; bool currentLineIsBlank = true; - while (millis()-now<1500) { + while (millis() - now < waitForResponse) { while (client->available()) { char c = client->read(); responseReceived=true; @@ -255,7 +255,7 @@ String UniversalTelegramBot::sendMultipartFormDataToTelegram(String command, Str now=millis(); bool finishedHeaders = false; bool currentLineIsBlank = true; - while (millis()-now<1500) { + while (millis() - now < waitForResponse) { while (client->available()) { char c = client->read(); responseReceived=true; diff --git a/src/UniversalTelegramBot.h b/src/UniversalTelegramBot.h index 3a2193b..5d1b0b8 100644 --- a/src/UniversalTelegramBot.h +++ b/src/UniversalTelegramBot.h @@ -87,6 +87,7 @@ class UniversalTelegramBot String userName; int longPoll = 0; bool _debug = false; + int waitForResponse = 1500; private: //JsonObject * parseUpdates(String response);