iobroker.telegram-menu 0.8.1 → 0.8.3
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 +9 -0
- package/admin/index_m.html +4 -2
- package/io-package.json +27 -27
- package/lib/js/setstate.js +4 -0
- package/lib/js/subMenu.js +23 -19
- package/lib/js/telegram.js +1 -0
- package/lib/js/utilities.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,6 +33,15 @@ 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.3 (2023-10-23)
|
|
37
|
+
|
|
38
|
+
- fix, step smaller than 1 in submenu number and percent
|
|
39
|
+
- gloabl fixes in submenu
|
|
40
|
+
|
|
41
|
+
### 0.8.2 (2023-10-22)
|
|
42
|
+
|
|
43
|
+
- fix {status:...}
|
|
44
|
+
|
|
36
45
|
### 0.8.1 (2023-10-22)
|
|
37
46
|
|
|
38
47
|
- hotfix, submenu switch
|
package/admin/index_m.html
CHANGED
|
@@ -592,8 +592,10 @@
|
|
|
592
592
|
let newData = $(this).clone().removeClass("startRow")
|
|
593
593
|
newData.find("a").parent().remove()
|
|
594
594
|
newData.find("td:empty").remove()
|
|
595
|
-
let checkbox = $("<a>").addClass(`btn-floating btn-small waves-effect waves-light blue ${toDo} checkboxCopyData `).append($("<i>").addClass("material-icons").text("add"))
|
|
596
|
-
|
|
595
|
+
let checkbox = $("<a title='Copy Data'>").addClass(`btn-floating btn-small waves-effect waves-light blue ${toDo} checkboxCopyData `).append($("<i>").addClass("material-icons").text("add"))
|
|
596
|
+
// let checkboxMove = $("<a title='Move Data'>").addClass(`btn-floating btn-small waves-effect waves-light blue ${toDo} checkboxMoveData `).append($("<i>").addClass("material-icons").text("trending_flat"))
|
|
597
|
+
// newData = newData.append($("<td style='width: 2%'>").append(checkbox)).append($("<td style='width: 2%'>").append(checkboxMove))
|
|
598
|
+
newData = newData.append($("<td style='width: 2%'>").append(checkbox))
|
|
597
599
|
tbody.append(newData)
|
|
598
600
|
})
|
|
599
601
|
})
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "telegram-menu",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.3",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.8.3": {
|
|
7
|
+
"en": "fix, step smaller than 1 in submenu number and percent\ngloabl fixes in submenu",
|
|
8
|
+
"de": "fix, schritt kleiner als 1 in untermenünummer und prozent\ngloabl fixes in submenu",
|
|
9
|
+
"ru": "исправить, шаг меньше 1 в подменю номер и процент\ngloabl исправляет в подменю",
|
|
10
|
+
"pt": "corrigir, passo menor que 1 no número submenu e por cento\ngloabl correções em submenu",
|
|
11
|
+
"nl": "vertaling:\ngloabel in submenu",
|
|
12
|
+
"fr": "fixer, faire plus petit que 1 dans le numéro de sous-menu et pour cent\ngloabl corrige dans le sous-menu",
|
|
13
|
+
"it": "correzione, passo più piccolo di 1 in numero submenu e per cento\nguaabl fissa in submenu",
|
|
14
|
+
"es": "fijado, paso más pequeño que 1 en submenú número y porcentaje\ngloabl fijados en submenu",
|
|
15
|
+
"pl": "metoda ta jest mniejsza niż 1 w liczbie submenu i 1%\nustalenie w podmenu",
|
|
16
|
+
"uk": "фіксація, крок менше 1 в субмену кількість і відсотків\nглобл закріплює в підменю",
|
|
17
|
+
"zh-cn": "fix 小于1级和4%\n分项abl f"
|
|
18
|
+
},
|
|
19
|
+
"0.8.2": {
|
|
20
|
+
"en": "fix {status:...}",
|
|
21
|
+
"de": "fix {status.}:",
|
|
22
|
+
"ru": "исправить {status.}:",
|
|
23
|
+
"pt": "correção",
|
|
24
|
+
"nl": "maak status",
|
|
25
|
+
"fr": "correction {status.}:",
|
|
26
|
+
"it": "correggere {status.}:",
|
|
27
|
+
"es": "arréglalo",
|
|
28
|
+
"pl": "refix {status.}",
|
|
29
|
+
"uk": "фіксація {status.}:",
|
|
30
|
+
"zh-cn": "fixstatus:]"
|
|
31
|
+
},
|
|
6
32
|
"0.8.1": {
|
|
7
33
|
"en": "hotfix, submenu switch",
|
|
8
34
|
"de": "hotfix, untermenüschalter",
|
|
@@ -67,32 +93,6 @@
|
|
|
67
93
|
"pl": "#53: Wysyłanie serwera\nzaginęło 52 ikony\n#51 poprzez stworzenie nowego Menu, Użytkownicy nie zostali przedstawieni",
|
|
68
94
|
"uk": "#53 Функція: sendPicture фон сервер-path\n#52 іконки відсутні, копіювання даних\n#51 шляхом створення нового меню Користувачі не показані",
|
|
69
95
|
"zh-cn": "#53 特色:寄电器\n第52条 遗漏,复印数据\n第51号活动是创建一个新的男子,用户没有证明。"
|
|
70
|
-
},
|
|
71
|
-
"0.6.10": {
|
|
72
|
-
"en": "bug fix",
|
|
73
|
-
"de": "fehlerbehebung",
|
|
74
|
-
"ru": "исправление ошибки",
|
|
75
|
-
"pt": "correção de bugs",
|
|
76
|
-
"nl": "insecten",
|
|
77
|
-
"fr": "bug fix",
|
|
78
|
-
"it": "correzione bug",
|
|
79
|
-
"es": "bug",
|
|
80
|
-
"pl": "błąd",
|
|
81
|
-
"uk": "виправлення помилок",
|
|
82
|
-
"zh-cn": "bug fix"
|
|
83
|
-
},
|
|
84
|
-
"0.6.9": {
|
|
85
|
-
"en": "Rearranging listed actions #49\nwhen calling up the submenu, Text was send no entry found, fixed\nbug switch menu, fixed\nset a state, and receive the change of another state",
|
|
86
|
-
"de": "Rearrangieren von aufgelisteten Aktionen #49\nbeim Aufruf des Untermenüs, Text wurde nicht gefunden, behoben\nbugschalter-menü, fixiert\neinen zustand einstellen und die änderung eines anderen zustands empfangen",
|
|
87
|
-
"ru": "Организация перечисленных действий #49\nпри вызове подменю, текст не был отправлен не найден, исправлен\nменю переключателя баг, исправлено\nустановить состояние, и получить изменение другого государства",
|
|
88
|
-
"pt": "Reorganizar ações listadas #49\nao chamar o submenu, Texto não foi enviado nenhuma entrada encontrada, corrigido\nmenu de interruptor de bug, fixo\ndefinir um estado, e receber a mudança de outro estado",
|
|
89
|
-
"nl": "Vertaling:\ntoen ik de submenu belde, stuurde Text geen ingang gevonden\nvertaling:\nstel een staat voor en ontvang de verandering van een andere staat",
|
|
90
|
-
"fr": "Rearranging listed actions #49\nlorsque vous appelez le sous-menu, Texte n'a pas été envoyé trouvé, fixe\nmenu de commutation de bugs, fixe\ndéfinir un état, et recevoir le changement d'un autre état",
|
|
91
|
-
"it": "Rearrange azioni quotate #49\nquando si chiama il submenu, Testo non è stato inviato alcun elemento trovato, fisso\nmenu interruttore bug, fisso\nimpostare uno stato, e ricevere il cambiamento di un altro stato",
|
|
92
|
-
"es": "Reorganización de acciones enumeradas #49\nal llamar al submenú, Texto no fue enviado ninguna entrada encontrado, fijo\nmenú de conmutación de errores, fijo\nestablecer un estado, y recibir el cambio de otro estado",
|
|
93
|
-
"pl": "Rearrangacja #49\nkiedy wzywamy do podmenu, tekst nie został znaleziony, ustalony\nbug switch menu\nustanowiono państwo i otrzymało zmianę innego państwa",
|
|
94
|
-
"uk": "Залучення зазначених дій #49\nпри виклику підменю текст не був знайдений, фіксований\nменю вимикача, фіксована\nоберіть стан, і отримайте зміни іншої держави",
|
|
95
|
-
"zh-cn": "B. 安排所列行动 49\n在呼吁分包时,案文没有出入境,即固定。\nbugion menu,固定\na. 建立国家,并接受另一国的改变"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
package/lib/js/setstate.js
CHANGED
|
@@ -7,6 +7,10 @@ const sendToTelegram = require("./telegram").sendToTelegram;
|
|
|
7
7
|
* @param {string} userToSend User to send the message to
|
|
8
8
|
* @param {number} valueFromSubmenu Value from the submenu
|
|
9
9
|
* @param {boolean} SubmenuValuePriority If true the value from the submenu will be used else the value from the switch
|
|
10
|
+
* @param {string} telegramInstance Instance of telegram
|
|
11
|
+
* @param {boolean} resize_keyboard
|
|
12
|
+
* @param {boolean} one_time_keyboard
|
|
13
|
+
* @param {[]} userListWithChatID
|
|
10
14
|
* @returns Returns an array with the ids to set
|
|
11
15
|
*/
|
|
12
16
|
function setstate(
|
package/lib/js/subMenu.js
CHANGED
|
@@ -79,10 +79,10 @@ async function subMenu(
|
|
|
79
79
|
userToSend,
|
|
80
80
|
val,
|
|
81
81
|
true,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
instanceTelegram,
|
|
83
|
+
resize_keyboard,
|
|
84
|
+
one_time_keyboard,
|
|
85
|
+
userListWithChatID,
|
|
86
86
|
);
|
|
87
87
|
if (Array.isArray(result)) returnIDToListenTo = result;
|
|
88
88
|
return [null, null, null, returnIDToListenTo];
|
|
@@ -101,10 +101,10 @@ async function subMenu(
|
|
|
101
101
|
userToSend,
|
|
102
102
|
val,
|
|
103
103
|
true,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
instanceTelegram,
|
|
105
|
+
resize_keyboard,
|
|
106
|
+
one_time_keyboard,
|
|
107
|
+
userListWithChatID,
|
|
108
108
|
);
|
|
109
109
|
if (Array.isArray(result)) returnIDToListenTo = result;
|
|
110
110
|
return [null, null, null, returnIDToListenTo];
|
|
@@ -112,7 +112,7 @@ async function subMenu(
|
|
|
112
112
|
|
|
113
113
|
//ANCHOR - Percent
|
|
114
114
|
else if (!calledValue.includes("submenu") && callbackData.includes("percent")) {
|
|
115
|
-
step =
|
|
115
|
+
step = parseFloat(callbackData.replace("percent", ""));
|
|
116
116
|
let rowEntrys = 0;
|
|
117
117
|
let menu = [];
|
|
118
118
|
const keyboard = {
|
|
@@ -148,10 +148,10 @@ async function subMenu(
|
|
|
148
148
|
userToSend,
|
|
149
149
|
value,
|
|
150
150
|
true,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
instanceTelegram,
|
|
152
|
+
resize_keyboard,
|
|
153
|
+
one_time_keyboard,
|
|
154
|
+
userListWithChatID,
|
|
155
155
|
);
|
|
156
156
|
if (Array.isArray(result)) returnIDToListenTo = result;
|
|
157
157
|
return [null, null, null, returnIDToListenTo];
|
|
@@ -177,7 +177,11 @@ async function subMenu(
|
|
|
177
177
|
end = parseInt(splittedData[1]);
|
|
178
178
|
}
|
|
179
179
|
let index = -1;
|
|
180
|
-
|
|
180
|
+
|
|
181
|
+
let maxEntrysPerRow = 8;
|
|
182
|
+
if (parseFloat(splittedData[2]) < 1) maxEntrysPerRow = 6;
|
|
183
|
+
|
|
184
|
+
for (let i = start; i >= end; i -= parseFloat(splittedData[2])) {
|
|
181
185
|
// Zahlen umdrehen
|
|
182
186
|
if (parseInt(splittedData[0]) < parseInt(splittedData[1])) {
|
|
183
187
|
if (i === start) index = end - 1;
|
|
@@ -189,7 +193,7 @@ async function subMenu(
|
|
|
189
193
|
callback_data: `submenu:${callbackData}:${device2Switch}:${index}`,
|
|
190
194
|
});
|
|
191
195
|
rowEntrys++;
|
|
192
|
-
if (rowEntrys ==
|
|
196
|
+
if (rowEntrys == maxEntrysPerRow) {
|
|
193
197
|
// @ts-ignore
|
|
194
198
|
keyboard.inline_keyboard.push(menu);
|
|
195
199
|
menu = [];
|
|
@@ -214,10 +218,10 @@ async function subMenu(
|
|
|
214
218
|
userToSend,
|
|
215
219
|
value,
|
|
216
220
|
true,
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
+
instanceTelegram,
|
|
222
|
+
resize_keyboard,
|
|
223
|
+
one_time_keyboard,
|
|
224
|
+
userListWithChatID,
|
|
221
225
|
);
|
|
222
226
|
if (Array.isArray(result)) returnIDToListenTo = result;
|
|
223
227
|
return [null, null, null, returnIDToListenTo];
|
package/lib/js/telegram.js
CHANGED
|
@@ -22,6 +22,7 @@ function sendToTelegram(
|
|
|
22
22
|
_this.log.debug("Send this Value : " + JSON.stringify(value));
|
|
23
23
|
_this.log.debug("Send this to : " + JSON.stringify(user));
|
|
24
24
|
_this.log.debug("Instance : " + JSON.stringify(instance));
|
|
25
|
+
_this.log.debug("userListWithChatID : " + JSON.stringify(userListWithChatID));
|
|
25
26
|
let chatId = "";
|
|
26
27
|
userListWithChatID.forEach((element) => {
|
|
27
28
|
if (element.name === user) chatId = element.chatID;
|
package/lib/js/utilities.js
CHANGED
|
@@ -10,7 +10,8 @@ async function checkStatusInfo(_this, text) {
|
|
|
10
10
|
.replace(/'/g, "");
|
|
11
11
|
const value = await _this.getForeignStateAsync(id);
|
|
12
12
|
_this.log.debug(JSON.stringify({ id: id, val: value.val }));
|
|
13
|
-
if ((value && value.val) || value.val === 0) {
|
|
13
|
+
if ((value && value.val) || value.val === 0 || value.val == false || value.val == "false") {
|
|
14
|
+
console.log("test");
|
|
14
15
|
text = text.replace(text.slice(startindex, text.indexOf("}", startindex) + 1), value.val);
|
|
15
16
|
} else _this.log.debug("Error getting Value from " + JSON.stringify(id));
|
|
16
17
|
}
|