From b125986fb32a618a88de97974a56209af33d9634 Mon Sep 17 00:00:00 2001 From: avaksru <33891999+avaksru@users.noreply.github.com> Date: Mon, 13 Dec 2021 09:59:43 +0300 Subject: [PATCH] telegram add weekday, IP, ESP_NAME, date --- src/Telegram.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Telegram.cpp b/src/Telegram.cpp index c5526a07..6c37177c 100644 --- a/src/Telegram.cpp +++ b/src/Telegram.cpp @@ -76,6 +76,11 @@ void sendTelegramMsg() { String msg = sCmd.next(); if (sabject == "often") { msg.replace("#", " "); + msg.replace("%date%", timeNow->getDateTimeDotFormated()); + msg.replace("%weekday%", timeNow->getWeekday()); + msg.replace("%IP%", jsonReadStr(configSetupJson, F("ip"))); + msg.replace("%name%", jsonReadStr(configSetupJson, F("name"))); + myBot->sendMessage(jsonReadInt(configSetupJson, "chatId"), msg); SerialPrint("<-", F("Telegram"), "chat ID: " + String(jsonReadInt(configSetupJson, "chatId")) + ", msg: " + msg); } else { @@ -84,6 +89,11 @@ void sendTelegramMsg() { jsonWriteStr(telegramMsgJson, sabject, msg); msg.replace("#", " "); sabject.replace("#", " "); + msg.replace("%date%", timeNow->getDateTimeDotFormated()); + msg.replace("%weekday%", timeNow->getWeekday()); + msg.replace("%IP%", jsonReadStr(configSetupJson, F("ip"))); + msg.replace("%name%", jsonReadStr(configSetupJson, F("name"))); + myBot->sendMessage(jsonReadInt(configSetupJson, "chatId"), msg); SerialPrint("<-", F("Telegram"), "chat ID: " + String(jsonReadInt(configSetupJson, "chatId")) + ", msg: " + msg); }