Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iobroker.telegram-menu

Package Overview
Dependencies
Maintainers
2
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iobroker.telegram-menu - npm Package Compare versions

Comparing version 0.7.2 to 0.8.0

admin/js/helper.js

25

admin/js/component.js

@@ -24,4 +24,4 @@ /*global $*/

<td><input type="text" data-name="call" spellcheck="false" class="isString nav-call translateV startside" value="Startside" ></td>
<td><input type="text" data-name="value" spellcheck="false" class="isString nav-value " value="Licht, Steckdose && Iobroker, Heizung"></td>
<td><input type="text" data-name="text" spellcheck="false" class="isString nav-text" value="Wähle eine Aktion"></td>
<td><input type="text" data-name="value" spellcheck="false" class="isString nav-value add-text" value="Licht, Steckdose && Iobroker, Heizung"><a data-name="nav" class="waves-effect waves-light blue"><i class="material-icons">add_circle</i></a></td>
<td><input type="text" data-name="text" spellcheck="false" class="isString nav-text add-text" value="Wähle eine Aktion"><a data-name="navText" class="waves-effect waves-light blue"><i class="material-icons">add_circle</i></a></td>
<td></td>

@@ -54,4 +54,4 @@ <td></td>

<td><input type="text" data-name="call" spellcheck="false" class="isString nav-call" value="${call}"></td>
<td><input type="text" data-name="value" spellcheck="false" class="isString nav-value" value="${value}"></td>
<td><input type="text" data-name="text" spellcheck="false" class="isString nav-text" value="${text}"></td>
<td><input type="text" data-name="value" spellcheck="false" class="isString nav-value add-text" value="${value}"><a data-name="nav" class="waves-effect waves-light blue"><i class="material-icons">add_circle</i></a></td>
<td><input type="text" data-name="text" spellcheck="false" class="isString nav-text add-text" value="${text}"><a data-name="navText" class="waves-effect waves-light blue"><i class="material-icons">add_circle</i></a></td>
<td><a class="deleteRow btn-floating btn-small waves-effect waves-light red"><i class="material-icons">delete</i></a></td>

@@ -90,3 +90,3 @@ <td><a class="btn-floating btn-small waves-effect waves-light blue btn_down"><i class="material-icons" name="down">arrow_downward</i></a></td>

//SECTION - Save
// Row in Action Popup
// Since Second Row in Action Popup
function newTrInAction(val, array, rows) {

@@ -100,3 +100,3 @@ if (!array) {

<td><a class="btn-floating btn-small waves-effect waves-light blue btn_getID" title="Get ID"><i class="material-icons">edit</i></a></td>
<td><input class="get_text" spellcheck="false" type="text" value="${array[1]}"></td>
<td><input class="get_text add-text" spellcheck="false" type="text" value="${array[1]}"><a data-name="getText" class="waves-effect waves-light blue"><i class="material-icons">add_circle</i></a></td>
<td><label><input type="checkbox" class="filled-in newline_checkbox" ${array[2]} /><span></span></label></td>

@@ -112,3 +112,3 @@ <td><a class="deleteRow btn-floating btn-small waves-effect waves-light red" ><i class="material-icons">delete</i></a></td>

<td><input class="set_value checkValueSwitch" spellcheck="false" type="text" value="${array[3]}"></td>
<td><input class="returnText resetInput " spellcheck="false" type="text" value="${array[8]}"></td>
<td><input class="returnText resetInput add-text" spellcheck="false" type="text" value="${array[8]}"><a data-name="setText" class="waves-effect waves-light blue"><i class="material-icons">add_circle</i></a></td>
<td><label><input type="checkbox" class="filled-in confirm_checkbox" ${array[7]}/><span></span></label></td>

@@ -279,1 +279,12 @@ <td><label><input type="checkbox" class="filled-in switch_checkbox" ${array[4]}/><span></span></label></td>

}
function addTextToInputField(element) {
let btn = "";
if (element.text != "")
btn = /*html*/ `<a class="btn-floating btn-small waves-effect waves-light blue btn-addText"><i class="material-icons">add</i></a>`;
return /*html*/ `<tr>
<td class="data-text"><p >${element.text}</p></td>
<td><p class="info-text">${element.info}</p></td>
<td>${btn}</td>
</tr>`;
}

@@ -40,3 +40,3 @@ /*global $,newSelectInstanceRow */

for (let i = 0; i < doc.rows.length; i++) {
console.log(doc.rows[i]);
// console.log(doc.rows[i]);
if (

@@ -43,0 +43,0 @@ (doc.rows[i].value &&

{
"common": {
"name": "telegram-menu",
"version": "0.7.2",
"version": "0.8.0",
"news": {
"0.8.0": {
"en": "text blocks created as a selection list, including the selection of the ID\ntext in submenus is now editable in the textfield in the navigation\nset ID by open a menu\nget status\nsmall fixes",
"de": "als Auswahlliste erstellte Textblöcke, einschließlich der Auswahl der ID\ntext in untermenü ist nun im textfeld in der navigation editierbar\niD durch Menü öffnen\nstatus\nkleine fixierungen",
"ru": "текстовые блоки, созданные как список отбора, включая подбор ID\nтекст в подменю теперь редактируем в текстовом поле в навигации\nустановите ID, откройте меню\nполучить статус\nнебольшие исправления",
"pt": "blocos de texto criados como uma lista de seleção, incluindo a seleção do ID\ntexto no submenus agora é editável no campo de texto na navegação\nset ID por abrir um menu\nobter status\npequenas correções",
"nl": "vertaling:\nsms in submenus is nu editabel in het sms in de navigatie\niD van een menukaart\nsta op\nkleine fixes",
"fr": "blocs texte créés comme liste de sélection, y compris la sélection de l'ID\ntext in submenus is now editable in the textfield in the navigation\nset ID by open a menu\nobtenir le statut\npetites corrections",
"it": "blocchi di testo creati come elenco di selezione, inclusa la selezione dell'ID\ntesto in submenus è ora modificabile nel campo di testo nella navigazione\nset ID per aprire un menu\nottenere stato\npiccole correzioni",
"es": "bloques de texto creados como lista de selección, incluyendo la selección del ID\ntexto en submenú es ahora editable en el campo de texto en la navegación\nestablecer ID por abrir un menú\nobtener el estado\npequeños accesorios",
"pl": "bloki tekstowe tworzone jako lista wyborcza, w tym wybór ID\ntekst w podmenu jest obecnie edytowany w polu tekstowym w nawigacji\nzademonstrowany przez otwarte menu\nmieć status\ndrobne rozwiązanie",
"uk": "текстові блоки, створені в списку вибору, включаючи вибір ID\nтекст в підменю тепер редагований в текстовому полі на навігацію\nвстановіть ID за допомогою меню\nотримати статус\nмаленькі кріплення",
"zh-cn": "选择名单,包括选择裁研所的案文\n导航场案文现在可归入。\n开 门\n身份\n小型配件"
},
"0.7.2": {

@@ -83,15 +96,2 @@ "en": "submenu Number fixed\ntext is lost when editing #63\nconvert milliseconds value to a local time specification\nsetstate and get result of another state with text adjusted",

"zh-cn": "混乱 Id\n在编辑、固定固定的固定编辑时,没有出现引擎。"
},
"0.6.7": {
"en": "fixed, send menu with error",
"de": "fest, menü mit fehler senden",
"ru": "фиксированное, отправить меню с ошибкой",
"pt": "fixo, enviar menu com erro",
"nl": "vertaling:",
"fr": "fixe, envoyer le menu avec erreur",
"it": "fisso, inviare menu con errore",
"es": "fijo, enviar menú con error",
"pl": "zastosowano menu z błędem",
"uk": "виправлено, відправте меню з помилкою",
"zh-cn": "a. 固定状态,向男子发出错误的通知"
}

@@ -98,0 +98,0 @@ },

@@ -17,3 +17,4 @@ const sendToTelegram = require("./telegram").sendToTelegram;

} catch (e) {
_this.log.error("Error Eval" + JSON.stringify(e));
_this.log.error("Error Eval" + JSON.stringify(e.message));
_this.log.error(JSON.stringify(e.stack));
}

@@ -72,3 +73,4 @@ textToSend = textToSend.replace(substring, "");

} catch (err) {
_this.log.error("Error EditArray: " + err);
_this.log.error("Error EditArray: " + JSON.stringify(err.message));
_this.log.error(JSON.stringify(err.stack));
}

@@ -106,29 +108,25 @@ }

const promises = enums.map(async (id) => {
try {
const value = await _this.getForeignStateAsync(id);
if (value && value.val) {
_this.log.debug("Value " + JSON.stringify(value.val));
_this.log.debug("text " + JSON.stringify(text));
let newtext = text;
let name;
if (text.includes("{common.name}")) {
_this.log.debug("test ");
name = await _this.getForeignObjectAsync(id);
_this.log.debug("Name " + JSON.stringify(name));
// _this.log.debug("Name " + JSON.stringify(await _this.getForeignObjectAsync(id)));
if (name && name.common.name)
newtext = newtext.replace("{common.name}", name.common.name);
}
if (text.includes("&amp;&amp;")) text2Send += newtext.replace("&amp;&amp;", value.val);
else {
text2Send += newtext;
text2Send += " " + value.val;
}
const value = await _this.getForeignStateAsync(id);
if (value && value.val) {
_this.log.debug("Value " + JSON.stringify(value.val));
_this.log.debug("text " + JSON.stringify(text));
let newtext = text;
let name;
if (text.includes("{common.name}")) {
_this.log.debug("test ");
name = await _this.getForeignObjectAsync(id);
_this.log.debug("Name " + JSON.stringify(name));
// _this.log.debug("Name " + JSON.stringify(await _this.getForeignObjectAsync(id)));
if (name && name.common.name)
newtext = newtext.replace("{common.name}", name.common.name);
}
if (newline == "true") text2Send += "\n";
else text2Send += " ";
_this.log.debug("text2send " + JSON.stringify(text2Send));
} catch (e) {
_this.log.error("Error idBySelector: " + JSON.stringify(e));
if (text.includes("&amp;&amp;")) text2Send += newtext.replace("&amp;&amp;", value.val);
else {
text2Send += newtext;
text2Send += " " + value.val;
}
}
if (newline == "true") text2Send += "\n";
else text2Send += " ";
_this.log.debug("text2send " + JSON.stringify(text2Send));
});

@@ -152,3 +150,4 @@ Promise.all(promises)

.catch((e) => {
_this.log.debug("Error " + JSON.stringify(e));
_this.log.error("Error Promise: " + JSON.stringify(e.message));
_this.log.error(JSON.stringify(e.stack));
});

@@ -159,3 +158,4 @@ }

} catch (error) {
_this.log.error("Error " + JSON.stringify(error));
_this.log.error("Error " + JSON.stringify(error.message));
_this.log.error(JSON.stringify(error.stack));
}

@@ -183,3 +183,4 @@ };

} catch (err) {
_this.log.error("Error GenerateNewObjectStructure " + err);
_this.log.error("Error GenerateNewObjectStructure " + JSON.stringify(err.message));
_this.log.error(JSON.stringify(err.stack));
}

@@ -250,3 +251,4 @@ }

} catch (err) {
console.log("Error generateActions: " + err);
_this.log.error("Error generateActions" + JSON.stringify(err.message));
_this.log.error(JSON.stringify(err.stack));
}

@@ -253,0 +255,0 @@ }

@@ -100,6 +100,8 @@ const sendToTelegram = require("./telegram").sendToTelegram;

} catch (error) {
_this.log.error("Error Getdata: " + JSON.stringify(error));
_this.log.error("Error Getdata: " + JSON.stringify(error.message));
_this.log.error(JSON.stringify(error.stack));
}
});
}
module.exports = { getstate };

@@ -33,3 +33,13 @@ /**

}
/**
* Finds the first index of the searchValue
* @param {string} text Text to search in
* @param {string} searchValue Value to search for
* @returns Index of the first occurrence of searchValue
*/
module.exports = { deleteDoubleEntrysInArray, replaceAll, isJSON };
function startIndex(text, searchValue) {
return text.indexOf(searchValue);
}
module.exports = { deleteDoubleEntrysInArray, replaceAll, isJSON, startIndex };

@@ -77,3 +77,4 @@ const sendToTelegram = require("./telegram").sendToTelegram;

} catch (e) {
_this.log.error("Error parsing returnObj: " + JSON.stringify(e));
_this.log.error("Error parsing returnObj: " + JSON.stringify(e.message));
_this.log.error(JSON.stringify(e.stack));
}

@@ -89,3 +90,4 @@ }

.catch((e) => {
console.log(e);
_this.log.error(JSON.stringify(e.message));
_this.log.error(JSON.stringify(e.stack));
});

@@ -102,3 +104,4 @@ } else {

} catch (error) {
_this.log.error("Error Switch" + JSON.stringify(error));
_this.log.error("Error Switch" + JSON.stringify(error.message));
_this.log.error(JSON.stringify(error.stack));
}

@@ -105,0 +108,0 @@ }

const setstate = require("./setstate").setstate;
const sendToTelegram = require("./telegram").sendToTelegram;
const utilities = require("./utilities");
let step = 0;

@@ -10,3 +11,3 @@ let returnIDToListenTo = [];

* @param {*} _this
* @param {string} part
* @param {string} calledValue
* @param {{}} groupData - Data of the group

@@ -16,5 +17,5 @@ * @param {string} userToSend - user to send the message to

*/
function subMenu(
async function subMenu(
_this,
part,
calledValue,
groupData,

@@ -26,215 +27,222 @@ userToSend,

userListWithChatID,
part,
) {
_this.log.debug("Part: " + JSON.stringify(part));
let splittetText = [];
let callbackData = "";
let device2Switch = "";
if (part.includes('"')) {
splittetText = part.split(`"`)[1].split(":");
} else {
splittetText = part.split(":");
}
device2Switch = splittetText[2];
callbackData = splittetText[1];
try {
_this.log.debug("CalledValue: " + JSON.stringify(calledValue));
let text = "";
console.log(part.text);
if (part.text) text = await utilities.checkStatusInfo(_this, part.text);
let splittetText = [];
let callbackData = "";
let device2Switch = "";
if (calledValue.includes('"')) {
splittetText = calledValue.split(`"`)[1].split(":");
} else {
splittetText = calledValue.split(":");
}
device2Switch = splittetText[2];
callbackData = splittetText[1];
_this.log.debug("callbackData: " + JSON.stringify(callbackData));
_this.log.debug("splittet Data of callbackData " + JSON.stringify(splittetText[1]));
_this.log.debug("devicetoswitch: " + JSON.stringify(device2Switch));
_this.log.debug("text: " + JSON.stringify(part));
_this.log.debug("callbackData: " + JSON.stringify(callbackData));
_this.log.debug("splittet Data of callbackData " + JSON.stringify(splittetText[1]));
_this.log.debug("devicetoswitch: " + JSON.stringify(device2Switch));
_this.log.debug("text: " + JSON.stringify(calledValue));
//ANCHOR - Switch
//ANCHOR - Switch
if (callbackData.includes("switch")) {
splittedData = callbackData.split("-");
const keyboard = {
inline_keyboard: [
[
{
text: splittedData[1].split(".")[0],
callback_data: `menu:first:${device2Switch}`,
},
{
text: splittedData[2].split(".")[0],
callback_data: `menu:second:${device2Switch}`,
},
if (callbackData.includes("switch")) {
splittedData = callbackData.split("-");
const keyboard = {
inline_keyboard: [
[
{
text: splittedData[1].split(".")[0],
callback_data: `menu:first:${device2Switch}`,
},
{
text: splittedData[2].split(".")[0],
callback_data: `menu:second:${device2Switch}`,
},
],
],
],
};
return ["Wähle eine Option", JSON.stringify(keyboard), device2Switch];
} else if (callbackData.includes("first")) {
let val;
_this.log.debug("SplittedData " + JSON.stringify(splittedData));
if (splittedData[1].split(".")[1] == "false") {
val = false;
} else if (splittedData[1].split(".")[1] == "true") {
val = true;
} else {
val = splittedData[1].split(".")[1];
};
return [text, JSON.stringify(keyboard), device2Switch];
} else if (callbackData.includes("first")) {
let val;
_this.log.debug("SplittedData " + JSON.stringify(splittedData));
if (splittedData[1].split(".")[1] == "false") {
val = false;
} else if (splittedData[1].split(".")[1] == "true") {
val = true;
} else {
val = splittedData[1].split(".")[1];
}
const result = setstate(
_this,
groupData[device2Switch],
userToSend,
val,
true,
undefined,
undefined,
undefined,
undefined,
);
if (Array.isArray(result)) returnIDToListenTo = result;
return [null, null, null, returnIDToListenTo];
} else if (callbackData.includes("second")) {
let val;
if (splittedData[2].split(".")[1] == "false") {
val = false;
} else if (splittedData[2].split(".")[1] == "true") {
val = true;
} else {
val = splittedData[2].split(".")[1];
}
const result = setstate(
_this,
groupData[device2Switch],
userToSend,
val,
true,
undefined,
undefined,
undefined,
undefined,
);
if (Array.isArray(result)) returnIDToListenTo = result;
return [null, null, null, returnIDToListenTo];
}
const result = setstate(
_this,
groupData[device2Switch],
userToSend,
val,
true,
undefined,
undefined,
undefined,
undefined,
);
if (Array.isArray(result)) returnIDToListenTo = result;
return [null, null, null, returnIDToListenTo];
} else if (callbackData.includes("second")) {
let val;
if (splittedData[2].split(".")[1] == "false") {
val = false;
} else if (splittedData[2].split(".")[1] == "true") {
val = true;
} else {
val = splittedData[2].split(".")[1];
}
const result = setstate(
_this,
groupData[device2Switch],
userToSend,
val,
true,
undefined,
undefined,
undefined,
undefined,
);
if (Array.isArray(result)) returnIDToListenTo = result;
return [null, null, null, returnIDToListenTo];
}
//ANCHOR - Percent
else if (!part.includes("submenu") && callbackData.includes("percent")) {
step = parseInt(callbackData.replace("percent", ""));
let rowEntrys = 0;
let menu = [];
const keyboard = {
inline_keyboard: [],
};
for (let i = 100; i >= 0; i -= step) {
menu.push({
text: `${i}%`,
callback_data: `submenu:percent${step},${i}:${device2Switch}`,
});
if (i != 0 && i - step < 0)
//ANCHOR - Percent
else if (!calledValue.includes("submenu") && callbackData.includes("percent")) {
step = parseInt(callbackData.replace("percent", ""));
let rowEntrys = 0;
let menu = [];
const keyboard = {
inline_keyboard: [],
};
for (let i = 100; i >= 0; i -= step) {
menu.push({
text: `0%`,
callback_data: `submenu:percent${step},${0}:${device2Switch}`,
text: `${i}%`,
callback_data: `submenu:percent${step},${i}:${device2Switch}`,
});
rowEntrys++;
if (rowEntrys == 8) {
// @ts-ignore
keyboard.inline_keyboard.push(menu);
menu = [];
rowEntrys = 0;
if (i != 0 && i - step < 0)
menu.push({
text: `0%`,
callback_data: `submenu:percent${step},${0}:${device2Switch}`,
});
rowEntrys++;
if (rowEntrys == 8) {
// @ts-ignore
keyboard.inline_keyboard.push(menu);
menu = [];
rowEntrys = 0;
}
}
}
// @ts-ignore
if (rowEntrys != 0) keyboard.inline_keyboard.push(menu);
// @ts-ignore
if (rowEntrys != 0) keyboard.inline_keyboard.push(menu);
return [text, JSON.stringify(keyboard), device2Switch];
} else if (calledValue.includes(`submenu:percent${step}`)) {
const value = parseInt(calledValue.split(":")[1].split(",")[1]);
return ["Welcher Wert soll gesetzt werden?", JSON.stringify(keyboard), device2Switch];
} else if (part.includes(`submenu:percent${step}`)) {
const value = parseInt(part.split(":")[1].split(",")[1]);
const result = setstate(
_this,
groupData[device2Switch],
userToSend,
value,
true,
undefined,
undefined,
undefined,
undefined,
);
if (Array.isArray(result)) returnIDToListenTo = result;
return [null, null, null, returnIDToListenTo];
const result = setstate(
_this,
groupData[device2Switch],
userToSend,
value,
true,
undefined,
undefined,
undefined,
undefined,
);
if (Array.isArray(result)) returnIDToListenTo = result;
return [null, null, null, returnIDToListenTo];
//ANCHOR - Number
} else if (!calledValue.includes("submenu") && callbackData.includes("number")) {
const splittedData = callbackData.replace("number", "").split("-");
let rowEntrys = 0;
let menu = [];
const keyboard = {
inline_keyboard: [],
};
let unit = "";
if (splittedData[3] != "") unit = splittedData[3];
let start = 0,
end = 0;
//ANCHOR - Number
} else if (!part.includes("submenu") && callbackData.includes("number")) {
const splittedData = callbackData.replace("number", "").split("-");
let rowEntrys = 0;
let menu = [];
const keyboard = {
inline_keyboard: [],
};
let unit = "";
if (splittedData[3] != "") unit = splittedData[3];
let start = 0,
end = 0;
if (parseInt(splittedData[0]) < parseInt(splittedData[1])) {
start = parseInt(splittedData[1]);
end = parseInt(splittedData[0]);
} else {
start = parseInt(splittedData[0]);
end = parseInt(splittedData[1]);
}
let index = -1;
for (let i = start; i >= end; i -= parseInt(splittedData[2])) {
// Zahlen umdrehen
if (parseInt(splittedData[0]) < parseInt(splittedData[1])) {
if (i === start) index = end - 1;
index++;
} else index = i;
//FIXME - index eine position nach hinten geschoben
menu.push({
text: `${index}${unit}`,
callback_data: `submenu:${callbackData}:${device2Switch}:${index}`,
});
rowEntrys++;
if (rowEntrys == 8) {
// @ts-ignore
keyboard.inline_keyboard.push(menu);
menu = [];
rowEntrys = 0;
start = parseInt(splittedData[1]);
end = parseInt(splittedData[0]);
} else {
start = parseInt(splittedData[0]);
end = parseInt(splittedData[1]);
}
}
// @ts-ignore
if (rowEntrys != 0) keyboard.inline_keyboard.push(menu);
_this.log.debug("keyboard " + JSON.stringify(keyboard.inline_keyboard));
return ["Welcher Wert soll gesetzt werden?", JSON.stringify(keyboard), device2Switch];
} else if (part.includes(`submenu:${callbackData}`)) {
_this.log.debug("CallbackData" + JSON.stringify(callbackData));
//FIXME - value und device2Switch vertauscht
const value = parseInt(part.split(":")[3]);
device2Switch = part.split(":")[2];
_this.log.debug(
JSON.stringify({ device2Switch: device2Switch, data: groupData, user: userToSend, value: value }),
);
const result = setstate(
_this,
groupData[device2Switch],
userToSend,
value,
true,
undefined,
undefined,
undefined,
undefined,
);
if (Array.isArray(result)) returnIDToListenTo = result;
return [null, null, null, returnIDToListenTo];
}
//ANCHOR - Back menu
else if (callbackData === "back") {
const list = backMenu[userToSend].list;
if (list.length !== 0) {
sendToTelegram(
let index = -1;
for (let i = start; i >= end; i -= parseInt(splittedData[2])) {
// Zahlen umdrehen
if (parseInt(splittedData[0]) < parseInt(splittedData[1])) {
if (i === start) index = end - 1;
index++;
} else index = i;
//FIXME - index eine position nach hinten geschoben
menu.push({
text: `${index}${unit}`,
callback_data: `submenu:${callbackData}:${device2Switch}:${index}`,
});
rowEntrys++;
if (rowEntrys == 8) {
// @ts-ignore
keyboard.inline_keyboard.push(menu);
menu = [];
rowEntrys = 0;
}
}
// @ts-ignore
if (rowEntrys != 0) keyboard.inline_keyboard.push(menu);
_this.log.debug("keyboard " + JSON.stringify(keyboard.inline_keyboard));
return [text, JSON.stringify(keyboard), device2Switch];
} else if (calledValue.includes(`submenu:${callbackData}`)) {
_this.log.debug("CallbackData" + JSON.stringify(callbackData));
//FIXME - value und device2Switch vertauscht
const value = parseInt(calledValue.split(":")[3]);
device2Switch = calledValue.split(":")[2];
_this.log.debug(
JSON.stringify({ device2Switch: device2Switch, data: groupData, user: userToSend, value: value }),
);
const result = setstate(
_this,
groupData[device2Switch],
userToSend,
list[list.length - 1],
groupData[list[list.length - 1]].nav,
instanceTelegram,
resize_keyboard,
one_time_keyboard,
userListWithChatID,
value,
true,
undefined,
undefined,
undefined,
undefined,
);
if (Array.isArray(result)) returnIDToListenTo = result;
return [null, null, null, returnIDToListenTo];
}
backMenu[userToSend].last = list.pop();
//ANCHOR - Back menu
else if (callbackData === "back") {
const list = backMenu[userToSend].list;
if (list.length !== 0) {
sendToTelegram(
_this,
userToSend,
list[list.length - 1],
groupData[list[list.length - 1]].nav,
instanceTelegram,
resize_keyboard,
one_time_keyboard,
userListWithChatID,
);
}
backMenu[userToSend].last = list.pop();
}
} catch (error) {
_this.log.error("Error subMenu: " + JSON.stringify(error.message + error.stack));
}

@@ -241,0 +249,0 @@ }

@@ -38,3 +38,3 @@ /**

function (res) {
console.log("Sent Value to " + res + " users!");
_this.log.debug("Sent Value to " + JSON.stringify(res) + " users!");
},

@@ -56,3 +56,3 @@ );

function (res) {
console.log("Sent to " + res + " users");
_this.log.debug("Sent Value to " + JSON.stringify(res) + " users!");
},

@@ -62,3 +62,4 @@ );

} catch (e) {
_this.log.error("Error sendToTelegram: " + JSON.stringify(e));
_this.log.error("Error sendToTelegram: " + JSON.stringify(e.message));
_this.log.error(JSON.stringify(e.stack));
}

@@ -88,3 +89,4 @@ }

} catch (e) {
_this.log.error("Error sendToTelegramSubmenu: " + JSON.stringify(e));
_this.log.error("Error sendToTelegramSubmenu: " + JSON.stringify(e.message));
_this.log.error(JSON.stringify(e.stack));
}

@@ -91,0 +93,0 @@ }

@@ -19,2 +19,3 @@ "use strict";

const getstate = require("./lib/js/getstate").getstate;
const utilities = require("./lib/js/utilities");
const subMenu = require("./lib/js/subMenu").subMenu;

@@ -84,3 +85,4 @@ const backMenuFuc = require("./lib/js/subMenu").backMenuFuc;

} catch (e) {
this.log.error("Error getForeignState: " + JSON.stringify(e));
this.log.error("Error getForeignState: " + JSON.stringify(e.message));
this.log.error(JSON.stringify(e.stack));
}

@@ -118,3 +120,4 @@ telegramAktiv = telegramState?.val;

} catch (err) {
this.log.error("Error generateNav: " + JSON.stringify(err));
this.log.error("Error generateNav: " + JSON.stringify(err.message));
this.log.error(JSON.stringify(err.stack));
}

@@ -152,3 +155,4 @@ this.log.debug("Checkbox " + JSON.stringify(checkbox));

} catch (error) {
this.log.error("Error read UserList" + error);
this.log.error("Error read UserList" + JSON.stringify(error.message));
this.log.error(JSON.stringify(error.stack));
}

@@ -202,3 +206,3 @@ }

if (
processData(
await processData(
this,

@@ -297,3 +301,4 @@ groupData,

} catch (e) {
this.log.debug("Error1 " + JSON.stringify(e));
this.log.error("Error StateChange " + JSON.stringify(e.message));
this.log.error(JSON.stringify(e.stack));
}

@@ -312,3 +317,3 @@ });

*/
function processData(
async function processData(
_this,

@@ -324,4 +329,5 @@ groupData,

) {
let part;
if (groupData[calledValue] && userToSend && groupWithUser && userActiveCheckbox[groupWithUser]) {
const part = groupData[calledValue];
part = groupData[calledValue];
// Navigation

@@ -331,3 +337,4 @@ if (part.nav) {

backMenuFuc(_this, calledValue, part.nav, userToSend);
if (JSON.stringify(part.nav).includes("menu")) {
if (JSON.stringify(part.nav).includes("menu:")) {
_this.log.debug("Submenu");
callSubMenu(

@@ -342,2 +349,3 @@ _this,

userListWithChatID,
part,
);

@@ -348,6 +356,7 @@ return true;

_this.log.debug("Send Nav to Telegram");
const text = await utilities.checkStatusInfo(_this, part.text);
sendToTelegram(
_this,
userToSend,
part.text,
text,
part.nav,

@@ -419,3 +428,4 @@ instanceTelegram,

} catch (e) {
_this.log.error("Error :" + JSON.stringify(e));
_this.log.error("Error :" + JSON.stringify(e.message));
_this.log.error(JSON.stringify(e.stack));
}

@@ -429,22 +439,17 @@

const timeout = _this.setTimeout(async () => {
try {
_this.log.debug("Send Pic to Telegram");
sendToTelegram(
_this,
userToSend,
path,
undefined,
instanceTelegram,
resize_keyboard,
one_time_keyboard,
userListWithChatID,
);
let timeoutToClear = {};
timeoutToClear = timeouts.filter((item) => item.key == timeoutKey);
clearTimeout(timeoutToClear.timeout);
timeouts = timeouts.filter((item) => item.key !== timeoutKey);
} catch (e) {
_this.log.error("Error: " + JSON.stringify(e));
}
_this.log.debug("Send Pic to Telegram");
sendToTelegram(
_this,
userToSend,
path,
undefined,
instanceTelegram,
resize_keyboard,
one_time_keyboard,
userListWithChatID,
);
let timeoutToClear = {};
timeoutToClear = timeouts.filter((item) => item.key == timeoutKey);
clearTimeout(timeoutToClear.timeout);
timeouts = timeouts.filter((item) => item.key !== timeoutKey);
}, parseInt(element.delay));

@@ -454,3 +459,4 @@ _this.log.debug("Timeout add");

} catch (e) {
_this.log.error("Error: " + JSON.stringify(e));
_this.log.error("Error: " + JSON.stringify(e.message));
_this.log.error(JSON.stringify(e.stack));
}

@@ -474,2 +480,3 @@ });

userListWithChatID,
part,
);

@@ -481,12 +488,13 @@ return true;

}
/**
*
* @param {*} _this
* @param {string} part
* @param {*} calledValue
* @param {{}} groupData
* @param {string} userToSend
*/
function callSubMenu(
async function callSubMenu(
_this,
part,
calledValue,
groupData,

@@ -498,6 +506,7 @@ userToSend,

userListWithChatID,
part,
) {
const subMenuData = subMenu(
const subMenuData = await subMenu(
_this,
part,
calledValue,
groupData,

@@ -509,2 +518,3 @@ userToSend,

userListWithChatID,
part,
);

@@ -511,0 +521,0 @@ _this.log.debug("Submenu data " + JSON.stringify(subMenuData));

{
"name": "iobroker.telegram-menu",
"version": "0.7.2",
"version": "0.8.0",
"description": "Easily create Telegram Menus",

@@ -5,0 +5,0 @@ "author": {

@@ -36,2 +36,10 @@ ![Logo](admin/telegram-menu.png)

-->
### 0.8.0 (2023-10-22)
- text blocks created as a selection list, including the selection of the ID
- text in submenus is now editable in the textfield in the navigation
- set ID by open a menu
- get status
- small fixes
### 0.7.2 (2023-10-15)

@@ -38,0 +46,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc