iobroker.telegram-menu 0.8.5 → 0.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,6 +33,10 @@ You can create different groups with separate menus, and then assign users to th
33
33
  Placeholder for the next version (at the beginning of the line):
34
34
  ### **WORK IN PROGRESS**
35
35
  -->
36
+ ### 0.8.6 (2023-11-21)
37
+
38
+ - fixed change and set value
39
+
36
40
  ### 0.8.5 (2023-11-10)
37
41
 
38
42
  - fixed, menu:back in Subnavigation
@@ -50,14 +50,15 @@ const helperText = {
50
50
  { text: "{common.name}", info: " <span class='translate'>Outputs the name of the data point</span> " },
51
51
  { text: "&&", info: "<span class='translate'>Placeholder for the value</span>" },
52
52
  { text: "{round:2}", info: "<span class='translate'>Rounds the value for example to 2 decimal places</span>" },
53
- ],
54
- setText: [
55
- { text: "{novalue}", info: "<span class='translate'>The Value is not specified in the return text</span>" },
56
- { text: "ack:true", info: " <span class='translate'>Confirms the value</span> " },
57
53
  {
58
54
  text: 'change{"true":"an","false":"aus"}',
59
55
  info: "<span class='translate'>Changes the value in the return text, in this case from true to on and false to off</span>",
60
56
  },
57
+ ],
58
+ setText: [
59
+ { text: "{novalue}", info: "<span class='translate'>The Value is not specified in the return text</span>" },
60
+ { text: "ack:true", info: " <span class='translate'>Confirms the value</span> " },
61
+
61
62
  { text: "&&", info: "<span class='translate'>Placeholder for the value</span>" },
62
63
  {
63
64
  text: "{'id':'ID','text':'Your Text'}",
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "telegram-menu",
4
- "version": "0.8.5",
4
+ "version": "0.8.6",
5
5
  "news": {
6
+ "0.8.6": {
7
+ "en": "fixed change and set value",
8
+ "de": "fester änderungs- und sollwert",
9
+ "ru": "фиксированное изменение и установленное значение",
10
+ "pt": "mudança fixa e valor definido",
11
+ "nl": "verandering en waarde",
12
+ "fr": "changement fixe et valeur déterminée",
13
+ "it": "cambiamento fisso e valore impostato",
14
+ "es": "cambio fijo y valor establecido",
15
+ "pl": "zmiana stała i ustawa wartości",
16
+ "uk": "фіксована зміна та значення",
17
+ "zh-cn": "固定变化和固定价值"
18
+ },
6
19
  "0.8.5": {
7
20
  "en": "fixed, menu:back in Subnavigation",
8
21
  "de": "fest, Menü: Zurück in Subnavigation",
@@ -80,19 +93,6 @@
80
93
  "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",
81
94
  "uk": "текстові блоки, створені в списку вибору, включаючи вибір ID\nтекст в підменю тепер редагований в текстовому полі на навігацію\nвстановіть ID за допомогою меню\nотримати статус\nмаленькі кріплення",
82
95
  "zh-cn": "选择名单,包括选择裁研所的案文\n导航场案文现在可归入。\n开 门\n身份\n小型配件"
83
- },
84
- "0.7.2": {
85
- "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",
86
- "de": "unterpositionen Anzahl fest\ntext wird beim editieren von #63 verloren\nmillisekunden-wert in eine lokale zeitvorgabe umwandeln\nsetstate und erhalten ergebnis eines anderen staates mit text angepasst",
87
- "ru": "подменю Номер фиксированный\nтекст теряется при редактировании #63\nконвертировать миллисекундное значение в местную спецификацию времени\nsetstate и получить результат другого государства с текстом скорректирован",
88
- "pt": "submenu Número fixo\ntexto é perdido ao editar #63\nconverter valor de milissegundos para uma especificação de tempo local\nsetstate e obter resultado de outro estado com texto ajustado",
89
- "nl": "submenu Nummer gerepareerd\nsms is verloren als editing 63\nverbergt milliseconden waarde voor een plaatselijke tijd specifiek\nvertaling:",
90
- "fr": "sous-menu Nombre fixe\ntexte est perdu lors de l'édition #63\nconvertir la valeur millisecondes à une spécification locale\nsetstate and get result of another state with text adjusted",
91
- "it": "sottomenu Numero fisso\ntesto si perde quando si modifica #63\nconvertire il valore di millisecondi in una specifica dell'ora locale\nsetstate e ottenere il risultato di un altro stato con testo regolato",
92
- "es": "submenú Número fijo\ntexto se pierde cuando se edita #63\nconvertir el valor de milisegundos a una especificación de tiempo local\nsetstate y obtener resultado de otro estado con texto ajustado",
93
- "pl": "submenu liczba stała\ntekst został utracony podczas edycji #63\nwartość zwrotu milisekund do specyfikacji czasu lokalnego\nzbiór i dostaniemy rezultat innego stanu z tekstem dostosowywanym",
94
- "uk": "субмену Номер фіксований\nтекст втрачено при редагування #63\nконвертувати значення мілісекундів в локальну специфікацію часу\nsetstate і отримати результат іншої держави з текстом",
95
- "zh-cn": "分项 固定人数\n编辑第63号\n当地时间的具体化肥价值\na. 一国和另一国由于经调整案文"
96
96
  }
97
97
  },
98
98
  "titleLang": {
package/lib/js/action.js CHANGED
@@ -82,17 +82,7 @@ async function editArrayButtons(val, _this) {
82
82
  * @param {string} userToSend User to send
83
83
  * @param {string} newline Newline
84
84
  */
85
- const idBySelector = async (
86
- _this,
87
- selector,
88
- text,
89
- userToSend,
90
- newline,
91
- telegramInstance,
92
- one_time_keyboard,
93
- resize_keyboard,
94
- userListWithChatID,
95
- ) => {
85
+ const idBySelector = async (_this, selector, text, userToSend, newline, telegramInstance, one_time_keyboard, resize_keyboard, userListWithChatID) => {
96
86
  let text2Send = "";
97
87
  try {
98
88
  if (selector.includes("functions")) {
@@ -115,8 +105,7 @@ const idBySelector = async (
115
105
  name = await _this.getForeignObjectAsync(id);
116
106
  _this.log.debug("Name " + JSON.stringify(name));
117
107
  // _this.log.debug("Name " + JSON.stringify(await _this.getForeignObjectAsync(id)));
118
- if (name && name.common.name)
119
- newtext = newtext.replace("{common.name}", name.common.name);
108
+ if (name && name.common.name) newtext = newtext.replace("{common.name}", name.common.name);
120
109
  }
121
110
  if (text.includes("&amp;&amp;")) text2Send += newtext.replace("&amp;&amp;", value.val);
122
111
  else {
@@ -137,16 +126,7 @@ const idBySelector = async (
137
126
  _this.log.debug("text2send " + JSON.stringify(text2Send));
138
127
  _this.log.debug("usertosend " + JSON.stringify(userToSend));
139
128
 
140
- sendToTelegram(
141
- _this,
142
- userToSend,
143
- text,
144
- undefined,
145
- telegramInstance,
146
- one_time_keyboard,
147
- resize_keyboard,
148
- userListWithChatID,
149
- );
129
+ sendToTelegram(_this, userToSend, text, undefined, telegramInstance, one_time_keyboard, resize_keyboard, userListWithChatID);
150
130
  })
151
131
  .catch((e) => {
152
132
  _this.log.error("Error Promise: " + JSON.stringify(e.message));
@@ -32,6 +32,8 @@ function getstate(_this, part, userToSend, telegramInstance, one_time_keyboard,
32
32
  }
33
33
  if (value) {
34
34
  let val = JSON.stringify(value.val);
35
+ val = val.replace(/\\/g, "").replace(/"/g, "");
36
+
35
37
  _this.log.debug("Element.text " + JSON.stringify(element.text));
36
38
  let newline = "";
37
39
  if (element.newline === "true") {
@@ -67,6 +69,7 @@ function getstate(_this, part, userToSend, telegramInstance, one_time_keyboard,
67
69
  }
68
70
  if (textToSend.includes("change{")) {
69
71
  result = exchangeValue(textToSend, val, _this);
72
+ console.log("result " + JSON.stringify(result));
70
73
  val = result["valueChange"];
71
74
  _this.log.debug("result " + JSON.stringify(result));
72
75
  textToSend = result["textToSend"];
@@ -16,17 +16,20 @@ async function checkStatusInfo(_this, text) {
16
16
  }
17
17
  if (text.includes("{set:")) {
18
18
  const result = global.decomposeText(text, "{set:", "}");
19
- const id = result.subString.split(",")[0].replace("'id':", "").replace(/'/g, "");
20
- const importedValue = result.subString.split(",")[1];
19
+ const id = result.substring.split(",")[0].replace("{set:'id':", "").replace(/'/g, "");
20
+ const importedValue = result.substring.split(",")[1];
21
21
 
22
22
  text = result.textWithoutSubstring;
23
23
  const convertedValue = await checkTypeOfId(_this, id, importedValue);
24
24
  let ack;
25
- if (result.subString.split(",")[2] == "true") ack = true;
26
- else if (result.subString.split(",")[2] == "false") ack = false;
25
+ if (result.substring.split(",")[2].replace("}", "") == "true") ack = true;
26
+ else ack = false;
27
27
  _this.log.debug(JSON.stringify({ id: id, value: convertedValue, ack: ack }));
28
28
  if (text === "") text = "Wähle eine Aktion";
29
- _this.setForeignState(id, convertedValue, ack);
29
+ console.log("Setze " + id + " auf " + convertedValue);
30
+ console.log("Ack: " + ack);
31
+
32
+ await _this.setForeignState(id, convertedValue, ack);
30
33
  }
31
34
  return text;
32
35
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.telegram-menu",
3
- "version": "0.8.5",
3
+ "version": "0.8.6",
4
4
  "description": "Easily create Telegram Menus",
5
5
  "author": {
6
6
  "name": "MiRo1310",