Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
GyverLibs committed Sep 5, 2022
1 parent a8a62e3 commit 237629e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,7 @@ void loop() {
- добавил пример отправки фото с камеры ESP32-CAM
- v2.21: ускорил отправку файлов ботом в чат
- v2.22: мелкая оптимизация, исправил ошибку компиляции при дефайне FB_NO_OTA
- v2.23: пофиксил источник реального времени на editMessage
<a id="feedback"></a>
## Баги и обратная связь
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=FastBot
version=2.22
version=2.23
author=AlexGyver <[email protected]>
maintainer=AlexGyver <[email protected]>
sentence=Fast ESP8266/ESP32 library for Telegram bot (messages, menus, time sync, OTA update + SPIFFS, files upload and download)
Expand Down
26 changes: 14 additions & 12 deletions src/FastBot.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
- добавил пример отправки фото с камеры ESP32-CAM
v2.21: ускорил отправку файлов ботом в чат
v2.22: мелкая оптимизация, исправил ошибку компиляции при дефайне FB_NO_OTA
v2.23: пофиксил источник реального времени на editMessage
*/

/*
Expand Down Expand Up @@ -758,7 +759,7 @@ class FastBot {
// ===================== OTA =====================
// ОТА обновление, вызывать внутри обработчика сообщения по флагу OTA
uint8_t update(__attribute__((unused)) uint8_t type = FB_FIRMWARE) {
#ifndef FB_NO_OTA
#ifndef FB_NO_OTA
if (!_file_ptr) return 8;
OTAflag = type;
sendMessage((type == FB_FIRMWARE) ? F("OTA firmware...") : F("OTA spiffs..."), _otaID);
Expand All @@ -778,7 +779,7 @@ class FastBot {
if (OTAflag == FB_FIRMWARE) OTAstate = httpUpdate.update(client, *_file_ptr);
else if (OTAflag == FB_SPIFFS) OTAstate = httpUpdate.updateSpiffs(client, *_file_ptr);
#endif
#endif
#endif
return 1;
}

Expand Down Expand Up @@ -844,12 +845,12 @@ class FastBot {
}
#endif

// ============================ PRIVATE ============================
// ============================ PRIVATE ============================
private:
// конечная строка запроса
// конечная строка запроса
#define FB_END_REQ "\r\n" "--FAST_BOT--"

// тип клиента в зависимости от платформы
// тип клиента в зависимости от платформы
#ifdef ESP8266
#define FB_SECURE_CLIENT BearSSL::WiFiClientSecure
#else
Expand Down Expand Up @@ -980,20 +981,20 @@ class FastBot {
}
#endif

// ============================ CLIENT MACRO ============================
// макрос создания клиента в зависимости от платформы и настроек
// ============================ CLIENT MACRO ============================
// макрос создания клиента в зависимости от платформы и настроек
#ifdef ESP8266
#ifdef FB_DYNAMIC
#define FB_DECLARE_CLIENT() \
BearSSL::WiFiClientSecure client; \
client.setInsecure();
BearSSL::WiFiClientSecure client; \
client.setInsecure();
#else
#define FB_DECLARE_CLIENT()
#endif
#else
#define FB_DECLARE_CLIENT() \
WiFiClientSecure client; \
client.setInsecure();
WiFiClientSecure client; \
client.setInsecure();
#endif

// ============================ SEND BUF ============================
Expand Down Expand Up @@ -1243,7 +1244,8 @@ class FastBot {
_lastBotMsg = buf.toInt();
OK = 1;
}
if (find(answ, buf, st, F("\"date\":"), ',', answ.length())) {
if (find(answ, buf, st, F("\"edit_date\":"), ',', answ.length()) ||
find(answ, buf, st, F("\"date\":"), ',', answ.length())) {
_unix = buf.toInt();
_lastUpd = millis();
}
Expand Down

0 comments on commit 237629e

Please sign in to comment.