mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 14:42:18 +03:00
telegram
This commit is contained in:
@@ -70,23 +70,21 @@ void telegramMsgParse(String msg) {
|
||||
}
|
||||
|
||||
void sendTelegramMsg() {
|
||||
String id = sCmd.next();
|
||||
String msg = sCmd.next();
|
||||
String type = sCmd.next();
|
||||
msg.replace("#", " ");
|
||||
if (type == "1") {
|
||||
static String prevMsg;
|
||||
if (prevMsg != msg) {
|
||||
prevMsg = msg;
|
||||
if (msg != "na") {
|
||||
myBot->sendMessage(jsonReadInt(configSetupJson, "chatId"), msg);
|
||||
}
|
||||
SerialPrint("<-", "Telegram", "chat ID: " + String(jsonReadInt(configSetupJson, "chatId")) + ", msg: " + msg);
|
||||
}
|
||||
}
|
||||
else if (type == "2") {
|
||||
if (id == "often") {
|
||||
myBot->sendMessage(jsonReadInt(configSetupJson, "chatId"), msg);
|
||||
SerialPrint("<-", "Telegram", "chat ID: " + String(jsonReadInt(configSetupJson, "chatId")) + ", msg: " + msg);
|
||||
}
|
||||
else {
|
||||
String prevMsg = jsonReadStr(telegramMsgJson, id);
|
||||
if (prevMsg != msg) {
|
||||
jsonWriteStr(telegramMsgJson, id, msg);
|
||||
myBot->sendMessage(jsonReadInt(configSetupJson, "chatId"), msg);
|
||||
SerialPrint("<-", "Telegram", "chat ID: " + String(jsonReadInt(configSetupJson, "chatId")) + ", msg: " + msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool isTelegramEnabled() {
|
||||
|
||||
Reference in New Issue
Block a user