iobroker.telegram-menu 0.8.2 → 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 +6 -1
- package/admin/index_m.html +4 -2
- package/io-package.json +14 -14
- package/lib/js/setstate.js +4 -0
- package/lib/js/subMenu.js +23 -19
- package/lib/js/telegram.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,8 +31,13 @@ You can create different groups with separate menus, and then assign users to th
|
|
|
31
31
|
|
|
32
32
|
<!--
|
|
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
|
+
|
|
36
41
|
### 0.8.2 (2023-10-22)
|
|
37
42
|
|
|
38
43
|
- fix {status:...}
|
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,21 @@
|
|
|
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
|
+
},
|
|
6
19
|
"0.8.2": {
|
|
7
20
|
"en": "fix {status:...}",
|
|
8
21
|
"de": "fix {status.}:",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "#53: Wysyłanie serwera\nzaginęło 52 ikony\n#51 poprzez stworzenie nowego Menu, Użytkownicy nie zostali przedstawieni",
|
|
81
94
|
"uk": "#53 Функція: sendPicture фон сервер-path\n#52 іконки відсутні, копіювання даних\n#51 шляхом створення нового меню Користувачі не показані",
|
|
82
95
|
"zh-cn": "#53 特色:寄电器\n第52条 遗漏,复印数据\n第51号活动是创建一个新的男子,用户没有证明。"
|
|
83
|
-
},
|
|
84
|
-
"0.6.10": {
|
|
85
|
-
"en": "bug fix",
|
|
86
|
-
"de": "fehlerbehebung",
|
|
87
|
-
"ru": "исправление ошибки",
|
|
88
|
-
"pt": "correção de bugs",
|
|
89
|
-
"nl": "insecten",
|
|
90
|
-
"fr": "bug fix",
|
|
91
|
-
"it": "correzione bug",
|
|
92
|
-
"es": "bug",
|
|
93
|
-
"pl": "błąd",
|
|
94
|
-
"uk": "виправлення помилок",
|
|
95
|
-
"zh-cn": "bug fix"
|
|
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;
|