iobroker.telegram-menu
Advanced tools
Comparing version 0.4.0 to 0.4.1
{ | ||
"common": { | ||
"name": "telegram-menu", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"news": { | ||
"0.4.1": { | ||
"en": "Return text for submenus adjusted", | ||
"de": "Rückgabetext für submenus angepasst", | ||
"ru": "Вернуться текст для подменю скорректирован", | ||
"pt": "Texto de retorno para submenus ajustado", | ||
"nl": "Een terugkeer sms voor submenus aangepast", | ||
"fr": "Texte de retour pour les sous-menus ajustés", | ||
"it": "Testo di ritorno per submenus regolato", | ||
"es": "Texto de retorno para submenú ajustado", | ||
"pl": "Powtórne teksty do podmenu poprawiły", | ||
"uk": "Повернення тексту для підменю", | ||
"zh-cn": "调整的分遣案文" | ||
}, | ||
"0.4.0": { | ||
@@ -83,15 +96,2 @@ "en": "change output value for getState\ncheckbox to disbale Text No Entry found in the settings #34\nsubmenu\n**changed!!!**, states are always set with ack false\nadapter does not restart when telegram restarts #35", | ||
"zh-cn": "Send Grafana Diagram" | ||
}, | ||
"0.0.7": { | ||
"en": "Bugs fixed\nTranslate", | ||
"de": "Fehler behoben\nÜbersetzung", | ||
"ru": "Баги фиксированные\nПеревести", | ||
"pt": "Bugs corrigidos\nTraduzir", | ||
"nl": "Bugs gemaakt\nVertaling:", | ||
"fr": "Bugs corrigés\nTraduire", | ||
"it": "Bug fissi\nTraduttore", | ||
"es": "Errores fijos\nTraducir", | ||
"pl": "Bug\nTranslat", | ||
"uk": "Виправлені помилки\nПереклад", | ||
"zh-cn": "固定的黑体\n笔译" | ||
} | ||
@@ -98,0 +98,0 @@ }, |
const setstate = require("./setstate").setstate; | ||
let step = 0; | ||
let device2Switch = ""; | ||
let returnIDToListenTo; | ||
/** | ||
@@ -37,5 +38,7 @@ * | ||
} else if (callbackData === "yes") { | ||
setstate(_this, groupData[device2Switch], userToSend, true); | ||
returnIDToListenTo = setstate(_this, groupData[device2Switch], userToSend, true); | ||
return [null, null, null, returnIDToListenTo]; | ||
} else if (callbackData === "no") { | ||
setstate(_this, groupData[device2Switch], userToSend, false); | ||
returnIDToListenTo = setstate(_this, groupData[device2Switch], userToSend, false); | ||
return [null, null, null, returnIDToListenTo]; | ||
} else if (callbackData === "on-off") { | ||
@@ -59,5 +62,8 @@ const keyboard = { | ||
} else if (callbackData === "on") { | ||
setstate(_this, groupData[device2Switch], userToSend, true, true); | ||
returnIDToListenTo = setstate(_this, groupData[device2Switch], userToSend, true, true); | ||
return [null, null, null, returnIDToListenTo]; | ||
} else if (callbackData === "off") { | ||
setstate(_this, groupData[device2Switch], userToSend, false, true); | ||
returnIDToListenTo = setstate(_this, groupData[device2Switch], userToSend, false, true); | ||
return [null, null, null, returnIDToListenTo]; | ||
//SECTION - Percent | ||
} else if (!text.includes("submenu") && callbackData.includes("percent")) { | ||
@@ -80,4 +86,2 @@ step = parseInt(callbackData.replace("percent", "")); | ||
}); | ||
// _this.log.debug("menu " + JSON.stringify(menu)); | ||
// _this.log.debug("keyboard " + JSON.stringify(keyboard.inline_keyboard)); | ||
rowEntrys++; | ||
@@ -98,3 +102,5 @@ if (rowEntrys == 8) { | ||
const value = parseInt(text.split(":")[2]); | ||
setstate(_this, groupData[device2Switch], userToSend, value, true); | ||
returnIDToListenTo = setstate(_this, groupData[device2Switch], userToSend, value, true); | ||
return [null, null, null, returnIDToListenTo]; | ||
//SECTION - Number | ||
} else if (!text.includes("submenu") && callbackData.includes("number")) { | ||
@@ -130,4 +136,4 @@ const splittedData = callbackData.replace("number", "").split("-"); | ||
const value = parseInt(text.split(":")[2]); | ||
setstate(_this, groupData[device2Switch], userToSend, value, true); | ||
_this.log.debug("cal " + JSON.stringify(callbackData)); | ||
returnIDToListenTo = setstate(_this, groupData[device2Switch], userToSend, value, true); | ||
return [null, null, null, returnIDToListenTo]; | ||
} | ||
@@ -134,0 +140,0 @@ } |
24
main.js
"use strict"; | ||
let setStateIdsToListenTo; | ||
function sendIdToOtherFile(Ids) { | ||
setStateIdsToListenTo = Ids; | ||
} | ||
/* | ||
@@ -25,4 +29,3 @@ * Created with @iobroker/create-adapter v2.3.0 | ||
let timeoutKey = 0; | ||
let setStateIds; | ||
let setStateIdsToListenTo; | ||
let subscribeForeignStateIds; | ||
@@ -107,6 +110,6 @@ // Load your modules here, e.g.: | ||
menu.data[name] = returnValue?.obj; | ||
setStateIds = returnValue?.ids; | ||
if (setStateIds && setStateIds?.length > 0) | ||
_subscribeForeignStatesAsync(setStateIds, _this); | ||
this.log.debug("SetForeignStates: " + JSON.stringify(setStateIds)); | ||
subscribeForeignStateIds = returnValue?.ids; | ||
if (subscribeForeignStateIds && subscribeForeignStateIds?.length > 0) | ||
_subscribeForeignStatesAsync(subscribeForeignStateIds, _this); | ||
this.log.debug("SetForeignStates: " + JSON.stringify(subscribeForeignStateIds)); | ||
this.log.debug("Name " + JSON.stringify(name)); | ||
@@ -283,2 +286,5 @@ this.log.debug("Array Buttons: " + JSON.stringify(value)); | ||
}); | ||
} else { | ||
this.log.debug("else " + JSON.stringify(id)); | ||
this.log.debug("else " + JSON.stringify(setStateIdsToListenTo)); | ||
} | ||
@@ -293,3 +299,3 @@ } | ||
} catch (e) { | ||
this.log.debug("Error " + JSON.stringify(e)); | ||
this.log.debug("Error1 " + JSON.stringify(e)); | ||
} | ||
@@ -299,2 +305,3 @@ }); | ||
}); | ||
/** | ||
@@ -309,2 +316,4 @@ * | ||
const subMenuData = subMenu(_this, part, groupData, userToSend); | ||
if (subMenuData && subMenuData[3]) setStateIdsToListenTo = subMenuData[3]; | ||
_this.log.debug("SubMenuData " + JSON.stringify(subMenuData)); | ||
@@ -362,2 +371,3 @@ if (subMenuData && subMenuData[0]) sendToTelegramSubmenu(_this, userToSend, subMenuData[0], subMenuData[1]); | ||
module.exports = { sendIdToOtherFile }; | ||
if (require.main !== module) { | ||
@@ -364,0 +374,0 @@ // Export the constructor in compact mode |
{ | ||
"name": "iobroker.telegram-menu", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Easily create Telegram Menus", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -36,2 +36,6 @@ ![Logo](admin/telegram-menu.png) | ||
--> | ||
### 0.4.1 (2023-07-30) | ||
- Return text for submenus adjusted | ||
### 0.4.0 (2023-07-28) | ||
@@ -38,0 +42,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
425209
2480
114