mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
telegram add weekday, IP, ESP_NAME, date
This commit is contained in:
@@ -76,6 +76,11 @@ void sendTelegramMsg() {
|
|||||||
String msg = sCmd.next();
|
String msg = sCmd.next();
|
||||||
if (sabject == "often") {
|
if (sabject == "often") {
|
||||||
msg.replace("#", " ");
|
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);
|
myBot->sendMessage(jsonReadInt(configSetupJson, "chatId"), msg);
|
||||||
SerialPrint("<-", F("Telegram"), "chat ID: " + String(jsonReadInt(configSetupJson, "chatId")) + ", msg: " + msg);
|
SerialPrint("<-", F("Telegram"), "chat ID: " + String(jsonReadInt(configSetupJson, "chatId")) + ", msg: " + msg);
|
||||||
} else {
|
} else {
|
||||||
@@ -84,6 +89,11 @@ void sendTelegramMsg() {
|
|||||||
jsonWriteStr(telegramMsgJson, sabject, msg);
|
jsonWriteStr(telegramMsgJson, sabject, msg);
|
||||||
msg.replace("#", " ");
|
msg.replace("#", " ");
|
||||||
sabject.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);
|
myBot->sendMessage(jsonReadInt(configSetupJson, "chatId"), msg);
|
||||||
SerialPrint("<-", F("Telegram"), "chat ID: " + String(jsonReadInt(configSetupJson, "chatId")) + ", msg: " + msg);
|
SerialPrint("<-", F("Telegram"), "chat ID: " + String(jsonReadInt(configSetupJson, "chatId")) + ", msg: " + msg);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user