@@ -64,7 +64,6 @@ String UniversalTelegramBot::buildCommand(const String& cmd) {
64
64
65
65
String UniversalTelegramBot::sendGetToTelegram (const String& command) {
66
66
String body, headers;
67
- bool avail;
68
67
69
68
// Connect with api.telegram.org if not already connected
70
69
if (!client->connected ()) {
@@ -99,7 +98,7 @@ String UniversalTelegramBot::sendGetToTelegram(const String& command) {
99
98
100
99
bool UniversalTelegramBot::readHTTPAnswer (String &body, String &headers) {
101
100
int ch_count = 0 ;
102
- long now = millis ();
101
+ unsigned long now = millis ();
103
102
bool finishedHeaders = false ;
104
103
bool currentLineIsBlank = true ;
105
104
bool responseReceived = false ;
@@ -268,7 +267,7 @@ String UniversalTelegramBot::sendMultipartFormDataToTelegram(
268
267
#endif
269
268
byte buffer[512 ];
270
269
int count = 0 ;
271
- char ch;
270
+
272
271
while (moreDataAvailableCallback ()) {
273
272
buffer[count] = getNextByteCallback ();
274
273
count++;
@@ -335,7 +334,7 @@ bool UniversalTelegramBot::setMyCommands(const String& commandArray) {
335
334
#endif // defined(_debug)
336
335
unsigned long sttime = millis ();
337
336
338
- while (millis () < sttime + 8000ul ) { // loop for a while to send the message
337
+ while (millis () - sttime < 8000ul ) { // loop for a while to send the message
339
338
response = sendPostToTelegram (BOT_CMD (" setMyCommands" ), payload.as <JsonObject>());
340
339
#ifdef _debug
341
340
Serial.println (" setMyCommands response" + response);
@@ -533,10 +532,10 @@ bool UniversalTelegramBot::sendSimpleMessage(const String& chat_id, const String
533
532
#ifdef TELEGRAM_DEBUG
534
533
Serial.println (F (" sendSimpleMessage: SEND Simple Message" ));
535
534
#endif
536
- long sttime = millis ();
535
+ unsigned long sttime = millis ();
537
536
538
537
if (text != " " ) {
539
- while (millis () < sttime + 8000 ) { // loop for a while to send the message
538
+ while (millis () - sttime < 8000ul ) { // loop for a while to send the message
540
539
String command = BOT_CMD (" sendMessage?chat_id=" );
541
540
command += chat_id;
542
541
command += F (" &text=" );
@@ -626,10 +625,10 @@ bool UniversalTelegramBot::sendPostMessage(JsonObject payload) {
626
625
serializeJson (payload, Serial);
627
626
Serial.println ();
628
627
#endif
629
- long sttime = millis ();
628
+ unsigned long sttime = millis ();
630
629
631
630
if (payload.containsKey (" text" )) {
632
- while (millis () < sttime + 8000 ) { // loop for a while to send the message
631
+ while (millis () - sttime < 8000ul ) { // loop for a while to send the message
633
632
String response = sendPostToTelegram (BOT_CMD (" sendMessage" ), payload);
634
633
#ifdef TELEGRAM_DEBUG
635
634
Serial.println (response);
@@ -650,10 +649,10 @@ String UniversalTelegramBot::sendPostPhoto(JsonObject payload) {
650
649
#ifdef TELEGRAM_DEBUG
651
650
Serial.println (F (" sendPostPhoto: SEND Post Photo" ));
652
651
#endif
653
- long sttime = millis ();
652
+ unsigned long sttime = millis ();
654
653
655
654
if (payload.containsKey (" photo" )) {
656
- while (millis () < sttime + 8000 ) { // loop for a while to send the message
655
+ while (millis () - sttime < 8000ul ) { // loop for a while to send the message
657
656
response = sendPostToTelegram (BOT_CMD (" sendPhoto" ), payload);
658
657
#ifdef TELEGRAM_DEBUG
659
658
Serial.println (response);
@@ -733,10 +732,10 @@ bool UniversalTelegramBot::sendChatAction(const String& chat_id, const String& t
733
732
#ifdef TELEGRAM_DEBUG
734
733
Serial.println (F (" SEND Chat Action Message" ));
735
734
#endif
736
- long sttime = millis ();
735
+ unsigned long sttime = millis ();
737
736
738
737
if (text != " " ) {
739
- while (millis () < sttime + 8000 ) { // loop for a while to send the message
738
+ while (millis () - sttime < 8000ul ) { // loop for a while to send the message
740
739
String command = BOT_CMD (" sendChatAction?chat_id=" );
741
740
command += chat_id;
742
741
command += F (" &action=" );
0 commit comments