iobroker.telegram-menu 2.2.4 → 2.3.0
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 +12 -0
- package/admin/build/index.js +49 -49
- package/admin/build/index.js.map +3 -3
- package/admin/css/button.css +3 -0
- package/admin/css/row-editor.css +1 -1
- package/admin/css/style.css +46 -25
- package/admin/css/textarea.css +7 -11
- package/admin/i18n/de/translations.json +124 -123
- package/admin/i18n/en/translations.json +3 -2
- package/admin/i18n/es/translations.json +3 -2
- package/admin/i18n/fr/translations.json +3 -2
- package/admin/i18n/it/translations.json +3 -2
- package/admin/i18n/nl/translations.json +3 -2
- package/admin/i18n/pl/translations.json +3 -2
- package/admin/i18n/pt/translations.json +3 -2
- package/admin/i18n/ru/translations.json +3 -2
- package/admin/i18n/uk/translations.json +3 -2
- package/admin/i18n/zh-cn/translations.json +3 -2
- package/admin/words.js +3 -1
- package/build/admin/src/config/helper.js +178 -0
- package/build/admin/src/config/helper.js.map +1 -0
- package/build/admin/src/lib/Utils.js +64 -0
- package/build/admin/src/lib/Utils.js.map +1 -0
- package/build/admin/src/types/event.js +3 -0
- package/build/admin/src/types/event.js.map +1 -0
- package/build/app/action.js +270 -0
- package/build/app/action.js.map +7 -0
- package/build/app/adapterManager.js +36 -0
- package/build/app/adapterManager.js.map +7 -0
- package/build/app/adapterStartMenuSend.js +59 -0
- package/build/app/adapterStartMenuSend.js.map +7 -0
- package/build/app/backMenu.js +110 -0
- package/build/app/backMenu.js.map +7 -0
- package/build/app/botAction.js +47 -0
- package/build/app/botAction.js.map +7 -0
- package/build/app/configVariables.js +56 -0
- package/build/app/configVariables.js.map +7 -0
- package/build/app/connection.js +42 -0
- package/build/app/connection.js.map +7 -0
- package/build/app/createState.js +42 -0
- package/build/app/createState.js.map +7 -0
- package/build/app/dynamicSwitch.js +69 -0
- package/build/app/dynamicSwitch.js.map +7 -0
- package/build/app/dynamicSwitchMenu.js +69 -0
- package/build/app/dynamicSwitchMenu.js.map +7 -0
- package/build/app/dynamicValue.js +80 -0
- package/build/app/dynamicValue.js.map +7 -0
- package/build/app/echarts.js +60 -0
- package/build/app/echarts.js.map +7 -0
- package/build/app/getstate.js +148 -0
- package/build/app/getstate.js.map +7 -0
- package/build/app/global.js +2 -0
- package/build/app/global.js.map +7 -0
- package/build/app/httpRequest.js +84 -0
- package/build/app/httpRequest.js.map +7 -0
- package/build/app/jsonTable.js +158 -0
- package/build/app/jsonTable.js.map +7 -0
- package/build/app/logging.js +46 -0
- package/build/app/logging.js.map +7 -0
- package/build/app/messageIds.js +116 -0
- package/build/app/messageIds.js.map +7 -0
- package/build/app/processData.js +198 -0
- package/build/app/processData.js.map +7 -0
- package/build/app/sendNav.js +49 -0
- package/build/app/sendNav.js.map +7 -0
- package/build/app/sendpic.js +95 -0
- package/build/app/sendpic.js.map +7 -0
- package/build/app/sentry.js +43 -0
- package/build/app/sentry.js.map +7 -0
- package/build/app/setStateIdsToListenTo.js +42 -0
- package/build/app/setStateIdsToListenTo.js.map +7 -0
- package/build/app/setstate.js +145 -0
- package/build/app/setstate.js.map +7 -0
- package/build/app/shoppingList.js +97 -0
- package/build/app/shoppingList.js.map +7 -0
- package/build/app/subMenu.js +281 -0
- package/build/app/subMenu.js.map +7 -0
- package/build/app/subscribeStates.js +41 -0
- package/build/app/subscribeStates.js.map +7 -0
- package/build/app/telegram.js +131 -0
- package/build/app/telegram.js.map +7 -0
- package/build/app/validateMenus.js +64 -0
- package/build/app/validateMenus.js.map +7 -0
- package/build/build/src/app/action.js +447 -0
- package/build/build/src/app/adapterStartMenuSend.js +37 -0
- package/build/build/src/app/backMenu.js +70 -0
- package/build/build/src/app/botAction.js +25 -0
- package/build/build/src/app/connection.js +19 -0
- package/build/build/src/app/createState.js +19 -0
- package/build/build/src/app/dynamicSwitch.js +51 -0
- package/build/build/src/app/dynamicValue.js +64 -0
- package/build/build/src/app/echarts.js +45 -0
- package/build/build/src/app/getstate.js +157 -0
- package/build/build/src/app/global.js +59 -0
- package/build/build/src/app/httpRequest.js +64 -0
- package/build/build/src/app/jsonTable.js +147 -0
- package/build/build/src/app/logging.js +13 -0
- package/build/build/src/app/messageIds.js +88 -0
- package/build/build/src/app/processData.js +208 -0
- package/build/build/src/app/sendNav.js +30 -0
- package/build/build/src/app/sendpic.js +69 -0
- package/build/build/src/app/setstate.js +126 -0
- package/build/build/src/app/shoppingList.js +72 -0
- package/build/build/src/app/subMenu.js +361 -0
- package/build/build/src/app/subscribeStates.js +25 -0
- package/build/build/src/app/telegram.js +101 -0
- package/build/build/src/lib/string.js +28 -0
- package/build/build/src/lib/time.js +23 -0
- package/build/build/src/lib/utilities.js +263 -0
- package/build/build/src/lib/utils.js +13 -0
- package/build/build/src/main.js +402 -0
- package/build/config/config.js +134 -0
- package/build/config/config.js.map +7 -0
- package/build/io-package.json +87 -87
- package/build/lib/action.js +1 -3
- package/build/lib/action.js.map +2 -2
- package/build/lib/adapterStartMenuSend.js.map +1 -1
- package/build/lib/appUtils.js +158 -0
- package/build/lib/appUtils.js.map +7 -0
- package/build/lib/appUtilsString.js +37 -0
- package/build/lib/appUtilsString.js.map +7 -0
- package/build/lib/backMenu.js.map +2 -2
- package/build/lib/botAction.js.map +1 -1
- package/build/lib/dynamicSwitch.js.map +1 -1
- package/build/lib/dynamicValue.js.map +1 -1
- package/build/lib/echarts.js.map +1 -1
- package/build/lib/getstate.js.map +1 -1
- package/build/lib/global.js.map +1 -1
- package/build/lib/httpRequest.js.map +1 -1
- package/build/lib/json.js +54 -0
- package/build/lib/json.js.map +7 -0
- package/build/lib/jsonTable.js.map +1 -1
- package/build/lib/math.js +41 -0
- package/build/lib/math.js.map +7 -0
- package/build/lib/messageIds.js.map +1 -1
- package/build/lib/object.js +35 -0
- package/build/lib/object.js.map +7 -0
- package/build/lib/processData.js +4 -18
- package/build/lib/processData.js.map +3 -3
- package/build/lib/sendNav.js.map +1 -1
- package/build/lib/sendpic.js +23 -22
- package/build/lib/sendpic.js.map +2 -2
- package/build/lib/setstate.js.map +1 -1
- package/build/lib/shoppingList.js.map +1 -1
- package/build/lib/splitValues.js +63 -0
- package/build/lib/splitValues.js.map +7 -0
- package/build/lib/string.js +125 -3
- package/build/lib/string.js.map +2 -2
- package/build/lib/subMenu.js +1 -2
- package/build/lib/subMenu.js.map +2 -2
- package/build/lib/subscribeStates.js.map +1 -1
- package/build/lib/telegram.js.map +1 -1
- package/build/lib/time.js +93 -0
- package/build/lib/time.js.map +7 -0
- package/build/lib/utilities.js +84 -281
- package/build/lib/utilities.js.map +3 -3
- package/build/lib/utils.js +66 -0
- package/build/lib/utils.js.map +7 -0
- package/build/main.js +151 -233
- package/build/main.js.map +3 -3
- package/build/src/app/action.js +239 -0
- package/build/src/app/action.js.map +1 -0
- package/build/src/app/adapterManager.js +12 -0
- package/build/src/app/adapterManager.js.map +1 -0
- package/build/src/app/adapterStartMenuSend.js +36 -0
- package/build/src/app/adapterStartMenuSend.js.map +1 -0
- package/build/src/app/backMenu.js +81 -0
- package/build/src/app/backMenu.js.map +1 -0
- package/build/src/app/botAction.js +25 -0
- package/build/src/app/botAction.js.map +1 -0
- package/build/src/app/configVariables.js +32 -0
- package/build/src/app/configVariables.js.map +1 -0
- package/build/src/app/connection.js +20 -0
- package/build/src/app/connection.js.map +1 -0
- package/build/src/app/createState.js +19 -0
- package/build/src/app/createState.js.map +1 -0
- package/build/src/app/dynamicSwitch.js +52 -0
- package/build/src/app/dynamicSwitch.js.map +1 -0
- package/build/src/app/dynamicSwitchMenu.js +52 -0
- package/build/src/app/dynamicSwitchMenu.js.map +1 -0
- package/build/src/app/dynamicValue.js +52 -0
- package/build/src/app/dynamicValue.js.map +1 -0
- package/build/src/app/echarts.js +33 -0
- package/build/src/app/echarts.js.map +1 -0
- package/build/src/app/getstate.js +122 -0
- package/build/src/app/getstate.js.map +1 -0
- package/build/src/app/global.js +8 -0
- package/build/src/app/global.js.map +1 -0
- package/build/src/app/httpRequest.js +55 -0
- package/build/src/app/httpRequest.js.map +1 -0
- package/build/src/app/jsonTable.js +147 -0
- package/build/src/app/jsonTable.js.map +1 -0
- package/build/src/app/logging.js +22 -0
- package/build/src/app/logging.js.map +1 -0
- package/build/src/app/messageIds.js +89 -0
- package/build/src/app/messageIds.js.map +1 -0
- package/build/src/app/processData.js +153 -0
- package/build/src/app/processData.js.map +1 -0
- package/build/src/app/sendNav.js +26 -0
- package/build/src/app/sendNav.js.map +1 -0
- package/build/src/app/sendpic.js +66 -0
- package/build/src/app/sendpic.js.map +1 -0
- package/build/src/app/sentry.js +18 -0
- package/build/src/app/sentry.js.map +1 -0
- package/build/src/app/setStateIdsToListenTo.js +17 -0
- package/build/src/app/setStateIdsToListenTo.js.map +1 -0
- package/build/src/app/setstate.js +114 -0
- package/build/src/app/setstate.js.map +1 -0
- package/build/src/app/shoppingList.js +74 -0
- package/build/src/app/shoppingList.js.map +1 -0
- package/build/src/app/subMenu.js +237 -0
- package/build/src/app/subMenu.js.map +1 -0
- package/build/src/app/subscribeStates.js +17 -0
- package/build/src/app/subscribeStates.js.map +1 -0
- package/build/src/app/telegram.js +83 -0
- package/build/src/app/telegram.js.map +1 -0
- package/build/src/app/validateMenus.js +30 -0
- package/build/src/app/validateMenus.js.map +1 -0
- package/build/src/config/config.js +100 -0
- package/build/src/config/config.js.map +1 -0
- package/build/src/lib/appUtils.js +126 -0
- package/build/src/lib/appUtils.js.map +1 -0
- package/build/src/lib/appUtilsString.js +13 -0
- package/build/src/lib/appUtilsString.js.map +1 -0
- package/build/src/lib/json.js +37 -0
- package/build/src/lib/json.js.map +1 -0
- package/build/src/lib/math.js +17 -0
- package/build/src/lib/math.js.map +1 -0
- package/build/src/lib/object.js +10 -0
- package/build/src/lib/object.js.map +1 -0
- package/build/src/lib/splitValues.js +35 -0
- package/build/src/lib/splitValues.js.map +1 -0
- package/build/src/lib/string.js +121 -0
- package/build/src/lib/string.js.map +1 -0
- package/build/src/lib/time.js +57 -0
- package/build/src/lib/time.js.map +1 -0
- package/build/src/lib/utilities.js +111 -0
- package/build/src/lib/utilities.js.map +1 -0
- package/build/src/lib/utils.js +37 -0
- package/build/src/lib/utils.js.map +1 -0
- package/build/src/main.js +332 -0
- package/build/src/main.js.map +1 -0
- package/build/src/test/setup.js +12 -0
- package/build/src/test/setup.js.map +1 -0
- package/build/src/types/types.js +3 -0
- package/build/src/types/types.js.map +1 -0
- package/build/test/integration.js +0 -1
- package/build/test/integration.js.map +1 -1
- package/build/test/mocha.setup.js +0 -1
- package/build/test/mocha.setup.js.map +1 -1
- package/build/test/package.js +0 -1
- package/build/test/package.js.map +1 -1
- package/build/test/setup.js +12 -0
- package/build/test/setup.js.map +1 -0
- package/build/test/test/appUtils.test.js +507 -0
- package/build/test/test/appUtils.test.js.map +1 -0
- package/build/test/test/appUtilsString.test.js +16 -0
- package/build/test/test/appUtilsString.test.js.map +1 -0
- package/build/test/test/math.test.js +33 -0
- package/build/test/test/math.test.js.map +1 -0
- package/build/test/test/object.test.js +54 -0
- package/build/test/test/object.test.js.map +1 -0
- package/build/test/test/string.test.js +361 -0
- package/build/test/test/string.test.js.map +1 -0
- package/build/test/test/time.test.js +201 -0
- package/build/test/test/time.test.js.map +1 -0
- package/build/test/test/utils.test.js +115 -0
- package/build/test/test/utils.test.js.map +1 -0
- package/build/types/types.js +15 -0
- package/build/types/types.js.map +3 -3
- package/io-package.json +19 -14
- package/package.json +14 -10
- package/build/main.test.js +0 -24
- package/build/main.test.js.map +0 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var configVariables_exports = {};
|
|
20
|
+
__export(configVariables_exports, {
|
|
21
|
+
getConfigVariables: () => getConfigVariables
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(configVariables_exports);
|
|
24
|
+
const getConfigVariables = (config) => {
|
|
25
|
+
var _a;
|
|
26
|
+
const telegramInstance = (_a = config.instance) != null ? _a : "telegram.0";
|
|
27
|
+
const checkboxes = config.checkbox;
|
|
28
|
+
const telegramParams = {
|
|
29
|
+
telegramInstance,
|
|
30
|
+
resize_keyboard: checkboxes.resKey,
|
|
31
|
+
one_time_keyboard: checkboxes.oneTiKey,
|
|
32
|
+
userListWithChatID: config.userListWithChatID
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
checkboxes,
|
|
36
|
+
telegramID: `${telegramInstance}.communicate.request`,
|
|
37
|
+
botSendMessageID: `${telegramInstance}.communicate.botSendMessageId`,
|
|
38
|
+
requestMessageID: `${telegramInstance}.communicate.requestMessageId`,
|
|
39
|
+
infoConnectionOfTelegram: `${telegramInstance}.info.connection`,
|
|
40
|
+
checkboxNoEntryFound: checkboxes.checkboxNoValueFound,
|
|
41
|
+
sendMenuAfterRestart: checkboxes.sendMenuAfterRestart,
|
|
42
|
+
listOfMenus: config.usersInGroup ? Object.keys(config.usersInGroup) : [],
|
|
43
|
+
token: config.tokenGrafana,
|
|
44
|
+
directoryPicture: config.directory,
|
|
45
|
+
isUserActiveCheckbox: config.userActiveCheckbox,
|
|
46
|
+
menusWithUsers: config.usersInGroup,
|
|
47
|
+
textNoEntryFound: config.textNoEntry,
|
|
48
|
+
dataObject: config.data,
|
|
49
|
+
telegramParams
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
getConfigVariables
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=configVariables.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/app/configVariables.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Checkboxes, DataObject, IsUserActiveCheckbox, TelegramParams } from '../types/types';\n\nexport const getConfigVariables = (\n config: ioBroker.AdapterConfig,\n): {\n telegramID: string;\n botSendMessageID: string;\n requestMessageID: string;\n infoConnectionOfTelegram: string;\n checkboxNoEntryFound: boolean;\n sendMenuAfterRestart: boolean;\n listOfMenus: string[];\n token: string;\n directoryPicture: string;\n isUserActiveCheckbox: IsUserActiveCheckbox;\n menusWithUsers: Record<string, string[]>;\n textNoEntryFound: string;\n dataObject: DataObject;\n checkboxes: Checkboxes;\n telegramParams: TelegramParams;\n} => {\n const telegramInstance = config.instance ?? 'telegram.0';\n const checkboxes = config.checkbox;\n const telegramParams: TelegramParams = {\n telegramInstance,\n resize_keyboard: checkboxes.resKey,\n one_time_keyboard: checkboxes.oneTiKey,\n userListWithChatID: config.userListWithChatID,\n };\n return {\n checkboxes,\n telegramID: `${telegramInstance}.communicate.request`,\n botSendMessageID: `${telegramInstance}.communicate.botSendMessageId`,\n requestMessageID: `${telegramInstance}.communicate.requestMessageId`,\n infoConnectionOfTelegram: `${telegramInstance}.info.connection`,\n checkboxNoEntryFound: checkboxes.checkboxNoValueFound,\n sendMenuAfterRestart: checkboxes.sendMenuAfterRestart,\n listOfMenus: config.usersInGroup ? Object.keys(config.usersInGroup) : [],\n token: config.tokenGrafana,\n directoryPicture: config.directory,\n isUserActiveCheckbox: config.userActiveCheckbox,\n menusWithUsers: config.usersInGroup,\n textNoEntryFound: config.textNoEntry,\n dataObject: config.data,\n telegramParams,\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,qBAAqB,CAC9B,WAiBC;AApBL;AAqBI,QAAM,oBAAmB,YAAO,aAAP,YAAmB;AAC5C,QAAM,aAAa,OAAO;AAC1B,QAAM,iBAAiC;AAAA,IACnC;AAAA,IACA,iBAAiB,WAAW;AAAA,IAC5B,mBAAmB,WAAW;AAAA,IAC9B,oBAAoB,OAAO;AAAA,EAC/B;AACA,SAAO;AAAA,IACH;AAAA,IACA,YAAY,GAAG,gBAAgB;AAAA,IAC/B,kBAAkB,GAAG,gBAAgB;AAAA,IACrC,kBAAkB,GAAG,gBAAgB;AAAA,IACrC,0BAA0B,GAAG,gBAAgB;AAAA,IAC7C,sBAAsB,WAAW;AAAA,IACjC,sBAAsB,WAAW;AAAA,IACjC,aAAa,OAAO,eAAe,OAAO,KAAK,OAAO,YAAY,IAAI,CAAC;AAAA,IACvE,OAAO,OAAO;AAAA,IACd,kBAAkB,OAAO;AAAA,IACzB,sBAAsB,OAAO;AAAA,IAC7B,gBAAgB,OAAO;AAAA,IACvB,kBAAkB,OAAO;AAAA,IACzB,YAAY,OAAO;AAAA,IACnB;AAAA,EACJ;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var connection_exports = {};
|
|
20
|
+
__export(connection_exports, {
|
|
21
|
+
checkIsTelegramActive: () => checkIsTelegramActive
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(connection_exports);
|
|
24
|
+
var import_main = require("../main");
|
|
25
|
+
var import_string = require("../lib/string");
|
|
26
|
+
const checkIsTelegramActive = async (dataPoint) => {
|
|
27
|
+
await import_main.adapter.setState("info.connection", false, true);
|
|
28
|
+
const telegramInfoConnection = await import_main.adapter.getForeignStateAsync(dataPoint);
|
|
29
|
+
import_main.adapter.log.debug(`Telegram Info Connection: ${(0, import_string.jsonString)(telegramInfoConnection)}`);
|
|
30
|
+
const value = telegramInfoConnection == null ? void 0 : telegramInfoConnection.val;
|
|
31
|
+
if (value) {
|
|
32
|
+
await import_main.adapter.setState("info.connection", telegramInfoConnection == null ? void 0 : telegramInfoConnection.val, true);
|
|
33
|
+
} else {
|
|
34
|
+
import_main.adapter.log.info("Telegram was found, but is not running. Please start!");
|
|
35
|
+
}
|
|
36
|
+
return !!value;
|
|
37
|
+
};
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
checkIsTelegramActive
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=connection.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/app/connection.ts"],
|
|
4
|
+
"sourcesContent": ["import { adapter } from '../main';\nimport { jsonString } from '../lib/string';\n\nexport const checkIsTelegramActive = async (dataPoint: string): Promise<boolean | undefined> => {\n await adapter.setState('info.connection', false, true);\n const telegramInfoConnection = await adapter.getForeignStateAsync(dataPoint);\n\n adapter.log.debug(`Telegram Info Connection: ${jsonString(telegramInfoConnection)}`);\n const value = telegramInfoConnection?.val;\n if (value) {\n await adapter.setState('info.connection', telegramInfoConnection?.val, true);\n } else {\n adapter.log.info('Telegram was found, but is not running. Please start!');\n }\n\n return !!value;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AACxB,oBAA2B;AAEpB,MAAM,wBAAwB,OAAO,cAAoD;AAC5F,QAAM,oBAAQ,SAAS,mBAAmB,OAAO,IAAI;AACrD,QAAM,yBAAyB,MAAM,oBAAQ,qBAAqB,SAAS;AAE3E,sBAAQ,IAAI,MAAM,iCAA6B,0BAAW,sBAAsB,CAAC,EAAE;AACnF,QAAM,QAAQ,iEAAwB;AACtC,MAAI,OAAO;AACP,UAAM,oBAAQ,SAAS,mBAAmB,iEAAwB,KAAK,IAAI;AAAA,EAC/E,OAAO;AACH,wBAAQ,IAAI,KAAK,uDAAuD;AAAA,EAC5E;AAEA,SAAO,CAAC,CAAC;AACb;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var createState_exports = {};
|
|
20
|
+
__export(createState_exports, {
|
|
21
|
+
createState: () => createState
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(createState_exports);
|
|
24
|
+
const createState = async (_this) => {
|
|
25
|
+
await _this.setObjectNotExistsAsync("communication.requestIds", {
|
|
26
|
+
type: "state",
|
|
27
|
+
common: {
|
|
28
|
+
name: "RequestIds",
|
|
29
|
+
type: "string",
|
|
30
|
+
role: "state",
|
|
31
|
+
read: true,
|
|
32
|
+
write: false,
|
|
33
|
+
def: ""
|
|
34
|
+
},
|
|
35
|
+
native: {}
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
createState
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=createState.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/app/createState.ts"],
|
|
4
|
+
"sourcesContent": ["import type TelegramMenu from '../main';\n\nconst createState = async (_this: TelegramMenu): Promise<void> => {\n await _this.setObjectNotExistsAsync('communication.requestIds', {\n type: 'state',\n common: {\n name: 'RequestIds',\n type: 'string',\n role: 'state',\n read: true,\n write: false,\n def: '',\n },\n native: {},\n });\n};\nexport { createState };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,MAAM,cAAc,OAAO,UAAuC;AAC9D,QAAM,MAAM,wBAAwB,4BAA4B;AAAA,IAC5D,MAAM;AAAA,IACN,QAAQ;AAAA,MACJ,MAAM;AAAA,MACN,MAAM;AAAA,MACN,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,MACP,KAAK;AAAA,IACT;AAAA,IACA,QAAQ,CAAC;AAAA,EACb,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var dynamicSwitch_exports = {};
|
|
20
|
+
__export(dynamicSwitch_exports, {
|
|
21
|
+
dynamicSwitch: () => dynamicSwitch
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(dynamicSwitch_exports);
|
|
24
|
+
var import_logging = require("./logging");
|
|
25
|
+
var import_utilities = require("../lib/utilities");
|
|
26
|
+
var import_main = require("../main");
|
|
27
|
+
async function dynamicSwitch(calledValue, device, text) {
|
|
28
|
+
try {
|
|
29
|
+
const changedCalledValue = await (0, import_utilities.checkStatusInfo)(calledValue);
|
|
30
|
+
const splittedArray = changedCalledValue == null ? void 0 : changedCalledValue.replace(/"/g, "").split(":");
|
|
31
|
+
if (!splittedArray) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
device = splittedArray[2];
|
|
35
|
+
const arrayOfValues = splittedArray[1].replace("dynSwitch", "").replace(/\]/g, "").replace(/\[/g, "").split(",");
|
|
36
|
+
const lengthOfRow = parseInt(splittedArray[3]) || 6;
|
|
37
|
+
const array = [];
|
|
38
|
+
const keyboard = { inline_keyboard: array };
|
|
39
|
+
if (arrayOfValues) {
|
|
40
|
+
let keyboardItemsArray = [];
|
|
41
|
+
arrayOfValues.forEach((value, index) => {
|
|
42
|
+
if (value.includes("|")) {
|
|
43
|
+
const splittedValue = value.split("|");
|
|
44
|
+
keyboardItemsArray.push({
|
|
45
|
+
text: splittedValue[0],
|
|
46
|
+
callback_data: `menu:dynS:${device}:${splittedValue[1]}`
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
keyboardItemsArray.push({
|
|
50
|
+
text: value,
|
|
51
|
+
callback_data: `menu:dynS:${device}:${value}`
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if ((index + 1) % lengthOfRow == 0 && index != 0 && arrayOfValues.length > 0 || index + 1 == arrayOfValues.length) {
|
|
55
|
+
keyboard.inline_keyboard.push(keyboardItemsArray);
|
|
56
|
+
keyboardItemsArray = [];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return { text, keyboard, device };
|
|
60
|
+
}
|
|
61
|
+
} catch (e) {
|
|
62
|
+
(0, import_logging.errorLogger)("Error parsing dynSwitch:", e, import_main.adapter);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
dynamicSwitch
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=dynamicSwitch.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/app/dynamicSwitch.ts"],
|
|
4
|
+
"sourcesContent": ["import { errorLogger } from './logging';\nimport type { KeyboardItems, Keyboard } from '../types/types';\nimport { checkStatusInfo } from '../lib/utilities';\nimport { adapter } from '../main';\n\nasync function dynamicSwitch(\n calledValue: string,\n device: string,\n text: string,\n): Promise<{ text?: string; keyboard: Keyboard; device: string } | undefined> {\n try {\n const changedCalledValue = await checkStatusInfo(calledValue);\n const splittedArray: string[] | undefined = changedCalledValue?.replace(/\"/g, '').split(':');\n\n if (!splittedArray) {\n return;\n }\n device = splittedArray[2];\n const arrayOfValues = splittedArray[1]\n .replace('dynSwitch', '')\n .replace(/\\]/g, '')\n .replace(/\\[/g, '')\n .split(',');\n\n const lengthOfRow = parseInt(splittedArray[3]) || 6;\n\n const array: KeyboardItems[][] = [];\n const keyboard: Keyboard = { inline_keyboard: array };\n if (arrayOfValues) {\n let keyboardItemsArray: KeyboardItems[] = [];\n arrayOfValues.forEach((value, index: number) => {\n if (value.includes('|')) {\n const splittedValue = value.split('|');\n keyboardItemsArray.push({\n text: splittedValue[0],\n callback_data: `menu:dynS:${device}:${splittedValue[1]}`,\n });\n } else {\n keyboardItemsArray.push({\n text: value,\n callback_data: `menu:dynS:${device}:${value}`,\n });\n }\n if (\n ((index + 1) % lengthOfRow == 0 && index != 0 && arrayOfValues.length > 0) ||\n index + 1 == arrayOfValues.length\n ) {\n keyboard.inline_keyboard.push(keyboardItemsArray);\n keyboardItemsArray = [];\n }\n });\n return { text, keyboard, device };\n }\n } catch (e: any) {\n errorLogger('Error parsing dynSwitch:', e, adapter);\n }\n}\nexport { dynamicSwitch };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA4B;AAE5B,uBAAgC;AAChC,kBAAwB;AAExB,eAAe,cACX,aACA,QACA,MAC0E;AAC1E,MAAI;AACA,UAAM,qBAAqB,UAAM,kCAAgB,WAAW;AAC5D,UAAM,gBAAsC,yDAAoB,QAAQ,MAAM,IAAI,MAAM;AAExF,QAAI,CAAC,eAAe;AAChB;AAAA,IACJ;AACA,aAAS,cAAc,CAAC;AACxB,UAAM,gBAAgB,cAAc,CAAC,EAChC,QAAQ,aAAa,EAAE,EACvB,QAAQ,OAAO,EAAE,EACjB,QAAQ,OAAO,EAAE,EACjB,MAAM,GAAG;AAEd,UAAM,cAAc,SAAS,cAAc,CAAC,CAAC,KAAK;AAElD,UAAM,QAA2B,CAAC;AAClC,UAAM,WAAqB,EAAE,iBAAiB,MAAM;AACpD,QAAI,eAAe;AACf,UAAI,qBAAsC,CAAC;AAC3C,oBAAc,QAAQ,CAAC,OAAO,UAAkB;AAC5C,YAAI,MAAM,SAAS,GAAG,GAAG;AACrB,gBAAM,gBAAgB,MAAM,MAAM,GAAG;AACrC,6BAAmB,KAAK;AAAA,YACpB,MAAM,cAAc,CAAC;AAAA,YACrB,eAAe,aAAa,MAAM,IAAI,cAAc,CAAC,CAAC;AAAA,UAC1D,CAAC;AAAA,QACL,OAAO;AACH,6BAAmB,KAAK;AAAA,YACpB,MAAM;AAAA,YACN,eAAe,aAAa,MAAM,IAAI,KAAK;AAAA,UAC/C,CAAC;AAAA,QACL;AACA,aACM,QAAQ,KAAK,eAAe,KAAK,SAAS,KAAK,cAAc,SAAS,KACxE,QAAQ,KAAK,cAAc,QAC7B;AACE,mBAAS,gBAAgB,KAAK,kBAAkB;AAChD,+BAAqB,CAAC;AAAA,QAC1B;AAAA,MACJ,CAAC;AACD,aAAO,EAAE,MAAM,UAAU,OAAO;AAAA,IACpC;AAAA,EACJ,SAAS,GAAQ;AACb,oCAAY,4BAA4B,GAAG,mBAAO;AAAA,EACtD;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var dynamicSwitchMenu_exports = {};
|
|
20
|
+
__export(dynamicSwitchMenu_exports, {
|
|
21
|
+
createDynamicSwitchMenu: () => createDynamicSwitchMenu
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(dynamicSwitchMenu_exports);
|
|
24
|
+
var import_logging = require("./logging");
|
|
25
|
+
var import_utilities = require("../lib/utilities");
|
|
26
|
+
var import_main = require("../main");
|
|
27
|
+
async function createDynamicSwitchMenu(calledValue, device, text) {
|
|
28
|
+
try {
|
|
29
|
+
const changedCalledValue = await (0, import_utilities.checkStatusInfo)(calledValue);
|
|
30
|
+
const splittedArray = changedCalledValue == null ? void 0 : changedCalledValue.replace(/"/g, "").split(":");
|
|
31
|
+
if (!splittedArray) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
device = splittedArray[2];
|
|
35
|
+
const arrayOfValues = splittedArray[1].replace("dynSwitch", "").replace(/\]/g, "").replace(/\[/g, "").split(",");
|
|
36
|
+
const lengthOfRow = parseInt(splittedArray[3]) || 6;
|
|
37
|
+
const array = [];
|
|
38
|
+
const keyboard = { inline_keyboard: array };
|
|
39
|
+
if (arrayOfValues) {
|
|
40
|
+
let keyboardItemsArray = [];
|
|
41
|
+
arrayOfValues.forEach((value, index) => {
|
|
42
|
+
if (value.includes("|")) {
|
|
43
|
+
const splittedValue = value.split("|");
|
|
44
|
+
keyboardItemsArray.push({
|
|
45
|
+
text: splittedValue[0],
|
|
46
|
+
callback_data: `menu:dynS:${device}:${splittedValue[1]}`
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
keyboardItemsArray.push({
|
|
50
|
+
text: value,
|
|
51
|
+
callback_data: `menu:dynS:${device}:${value}`
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if ((index + 1) % lengthOfRow == 0 && index != 0 && arrayOfValues.length > 0 || index + 1 == arrayOfValues.length) {
|
|
55
|
+
keyboard.inline_keyboard.push(keyboardItemsArray);
|
|
56
|
+
keyboardItemsArray = [];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return { text, keyboard, device };
|
|
60
|
+
}
|
|
61
|
+
} catch (e) {
|
|
62
|
+
(0, import_logging.errorLogger)("Error parsing dynSwitch:", e, import_main.adapter);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
createDynamicSwitchMenu
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=dynamicSwitchMenu.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/app/dynamicSwitchMenu.ts"],
|
|
4
|
+
"sourcesContent": ["import { errorLogger } from './logging';\nimport type { KeyboardItems, Keyboard } from '../types/types';\nimport { checkStatusInfo } from '../lib/utilities';\nimport { adapter } from '../main';\n\nasync function createDynamicSwitchMenu(\n calledValue: string,\n device: string,\n text: string,\n): Promise<{ text?: string; keyboard: Keyboard; device: string } | undefined> {\n try {\n const changedCalledValue = await checkStatusInfo(calledValue);\n const splittedArray: string[] | undefined = changedCalledValue?.replace(/\"/g, '').split(':');\n\n if (!splittedArray) {\n return;\n }\n device = splittedArray[2];\n const arrayOfValues = splittedArray[1]\n .replace('dynSwitch', '')\n .replace(/\\]/g, '')\n .replace(/\\[/g, '')\n .split(',');\n\n const lengthOfRow = parseInt(splittedArray[3]) || 6;\n\n const array: KeyboardItems[][] = [];\n const keyboard: Keyboard = { inline_keyboard: array };\n if (arrayOfValues) {\n let keyboardItemsArray: KeyboardItems[] = [];\n arrayOfValues.forEach((value, index: number) => {\n if (value.includes('|')) {\n const splittedValue = value.split('|');\n keyboardItemsArray.push({\n text: splittedValue[0],\n callback_data: `menu:dynS:${device}:${splittedValue[1]}`,\n });\n } else {\n keyboardItemsArray.push({\n text: value,\n callback_data: `menu:dynS:${device}:${value}`,\n });\n }\n if (\n ((index + 1) % lengthOfRow == 0 && index != 0 && arrayOfValues.length > 0) ||\n index + 1 == arrayOfValues.length\n ) {\n keyboard.inline_keyboard.push(keyboardItemsArray);\n keyboardItemsArray = [];\n }\n });\n return { text, keyboard, device };\n }\n } catch (e: any) {\n errorLogger('Error parsing dynSwitch:', e, adapter);\n }\n}\nexport { createDynamicSwitchMenu };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA4B;AAE5B,uBAAgC;AAChC,kBAAwB;AAExB,eAAe,wBACX,aACA,QACA,MAC0E;AAC1E,MAAI;AACA,UAAM,qBAAqB,UAAM,kCAAgB,WAAW;AAC5D,UAAM,gBAAsC,yDAAoB,QAAQ,MAAM,IAAI,MAAM;AAExF,QAAI,CAAC,eAAe;AAChB;AAAA,IACJ;AACA,aAAS,cAAc,CAAC;AACxB,UAAM,gBAAgB,cAAc,CAAC,EAChC,QAAQ,aAAa,EAAE,EACvB,QAAQ,OAAO,EAAE,EACjB,QAAQ,OAAO,EAAE,EACjB,MAAM,GAAG;AAEd,UAAM,cAAc,SAAS,cAAc,CAAC,CAAC,KAAK;AAElD,UAAM,QAA2B,CAAC;AAClC,UAAM,WAAqB,EAAE,iBAAiB,MAAM;AACpD,QAAI,eAAe;AACf,UAAI,qBAAsC,CAAC;AAC3C,oBAAc,QAAQ,CAAC,OAAO,UAAkB;AAC5C,YAAI,MAAM,SAAS,GAAG,GAAG;AACrB,gBAAM,gBAAgB,MAAM,MAAM,GAAG;AACrC,6BAAmB,KAAK;AAAA,YACpB,MAAM,cAAc,CAAC;AAAA,YACrB,eAAe,aAAa,MAAM,IAAI,cAAc,CAAC,CAAC;AAAA,UAC1D,CAAC;AAAA,QACL,OAAO;AACH,6BAAmB,KAAK;AAAA,YACpB,MAAM;AAAA,YACN,eAAe,aAAa,MAAM,IAAI,KAAK;AAAA,UAC/C,CAAC;AAAA,QACL;AACA,aACM,QAAQ,KAAK,eAAe,KAAK,SAAS,KAAK,cAAc,SAAS,KACxE,QAAQ,KAAK,cAAc,QAC7B;AACE,mBAAS,gBAAgB,KAAK,kBAAkB;AAChD,+BAAqB,CAAC;AAAA,QAC1B;AAAA,MACJ,CAAC;AACD,aAAO,EAAE,MAAM,UAAU,OAAO;AAAA,IACpC;AAAA,EACJ,SAAS,GAAQ;AACb,oCAAY,4BAA4B,GAAG,mBAAO;AAAA,EACtD;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var dynamicValue_exports = {};
|
|
20
|
+
__export(dynamicValue_exports, {
|
|
21
|
+
getDynamicValue: () => getDynamicValue,
|
|
22
|
+
removeUserFromDynamicValue: () => removeUserFromDynamicValue,
|
|
23
|
+
setDynamicValue: () => setDynamicValue
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(dynamicValue_exports);
|
|
26
|
+
var import_string = require("../lib/string");
|
|
27
|
+
var import_telegram = require("./telegram");
|
|
28
|
+
const setDynamicValueObj = {};
|
|
29
|
+
const setDynamicValue = async (returnText, ack, id, userToSend, telegramParams, parse_mode, confirm) => {
|
|
30
|
+
const { substring } = (0, import_string.decomposeText)(returnText, "{setDynamicValue:", "}");
|
|
31
|
+
let array = substring.split(":");
|
|
32
|
+
array = isBraceDeleteEntry(array);
|
|
33
|
+
const text = array[1];
|
|
34
|
+
if (text) {
|
|
35
|
+
await (0, import_telegram.sendToTelegram)({
|
|
36
|
+
userToSend,
|
|
37
|
+
textToSend: text,
|
|
38
|
+
telegramParams,
|
|
39
|
+
parse_mode
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
setDynamicValueObj[userToSend] = {
|
|
43
|
+
id,
|
|
44
|
+
ack,
|
|
45
|
+
returnText: text,
|
|
46
|
+
userToSend,
|
|
47
|
+
parse_mode,
|
|
48
|
+
confirm,
|
|
49
|
+
telegramParams,
|
|
50
|
+
valueType: array[2]
|
|
51
|
+
};
|
|
52
|
+
if (array[3] && array[3] != "") {
|
|
53
|
+
return { confirmText: array[3], id: array[4] };
|
|
54
|
+
}
|
|
55
|
+
return { confirmText: "", id: void 0 };
|
|
56
|
+
};
|
|
57
|
+
const getDynamicValue = (userToSend) => {
|
|
58
|
+
var _a;
|
|
59
|
+
return (_a = setDynamicValueObj[userToSend]) != null ? _a : null;
|
|
60
|
+
};
|
|
61
|
+
const removeUserFromDynamicValue = (userToSend) => {
|
|
62
|
+
if (setDynamicValueObj[userToSend]) {
|
|
63
|
+
delete setDynamicValueObj[userToSend];
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
};
|
|
68
|
+
function isBraceDeleteEntry(array) {
|
|
69
|
+
if (array[4] === "}") {
|
|
70
|
+
return array.slice(0, 4);
|
|
71
|
+
}
|
|
72
|
+
return array;
|
|
73
|
+
}
|
|
74
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
+
0 && (module.exports = {
|
|
76
|
+
getDynamicValue,
|
|
77
|
+
removeUserFromDynamicValue,
|
|
78
|
+
setDynamicValue
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=dynamicValue.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/app/dynamicValue.ts"],
|
|
4
|
+
"sourcesContent": ["import { decomposeText } from '../lib/string';\nimport { sendToTelegram } from './telegram';\nimport type { SetDynamicValue, SetDynamicValueObj, TelegramParams } from '../types/types';\n\nconst setDynamicValueObj: SetDynamicValueObj = {};\nexport const setDynamicValue = async (\n returnText: string,\n ack: boolean,\n id: string,\n userToSend: string,\n telegramParams: TelegramParams,\n parse_mode: boolean,\n confirm: string,\n): Promise<{ confirmText: string; id: string | undefined }> => {\n const { substring } = decomposeText(returnText, '{setDynamicValue:', '}');\n let array = substring.split(':');\n array = isBraceDeleteEntry(array);\n const text = array[1];\n if (text) {\n await sendToTelegram({\n userToSend,\n textToSend: text,\n telegramParams,\n parse_mode,\n });\n }\n setDynamicValueObj[userToSend] = {\n id,\n ack,\n returnText: text,\n userToSend,\n parse_mode,\n confirm,\n telegramParams,\n valueType: array[2],\n };\n\n if (array[3] && array[3] != '') {\n return { confirmText: array[3], id: array[4] };\n }\n return { confirmText: '', id: undefined };\n};\n\nexport const getDynamicValue = (userToSend: string): SetDynamicValue | null => setDynamicValueObj[userToSend] ?? null;\n\nexport const removeUserFromDynamicValue = (userToSend: string): boolean => {\n if (setDynamicValueObj[userToSend]) {\n delete setDynamicValueObj[userToSend];\n return true;\n }\n return false;\n};\n\nfunction isBraceDeleteEntry(array: string[]): string[] {\n if (array[4] === '}') {\n return array.slice(0, 4);\n }\n return array;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA8B;AAC9B,sBAA+B;AAG/B,MAAM,qBAAyC,CAAC;AACzC,MAAM,kBAAkB,OAC3B,YACA,KACA,IACA,YACA,gBACA,YACA,YAC2D;AAC3D,QAAM,EAAE,UAAU,QAAI,6BAAc,YAAY,qBAAqB,GAAG;AACxE,MAAI,QAAQ,UAAU,MAAM,GAAG;AAC/B,UAAQ,mBAAmB,KAAK;AAChC,QAAM,OAAO,MAAM,CAAC;AACpB,MAAI,MAAM;AACN,cAAM,gCAAe;AAAA,MACjB;AAAA,MACA,YAAY;AAAA,MACZ;AAAA,MACA;AAAA,IACJ,CAAC;AAAA,EACL;AACA,qBAAmB,UAAU,IAAI;AAAA,IAC7B;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,MAAM,CAAC;AAAA,EACtB;AAEA,MAAI,MAAM,CAAC,KAAK,MAAM,CAAC,KAAK,IAAI;AAC5B,WAAO,EAAE,aAAa,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE;AAAA,EACjD;AACA,SAAO,EAAE,aAAa,IAAI,IAAI,OAAU;AAC5C;AAEO,MAAM,kBAAkB,CAAC,eAA4C;AA3C5E;AA2C+E,kCAAmB,UAAU,MAA7B,YAAkC;AAAA;AAE1G,MAAM,6BAA6B,CAAC,eAAgC;AACvE,MAAI,mBAAmB,UAAU,GAAG;AAChC,WAAO,mBAAmB,UAAU;AACpC,WAAO;AAAA,EACX;AACA,SAAO;AACX;AAEA,SAAS,mBAAmB,OAA2B;AACnD,MAAI,MAAM,CAAC,MAAM,KAAK;AAClB,WAAO,MAAM,MAAM,GAAG,CAAC;AAAA,EAC3B;AACA,SAAO;AACX;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var echarts_exports = {};
|
|
20
|
+
__export(echarts_exports, {
|
|
21
|
+
getChart: () => getChart
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(echarts_exports);
|
|
24
|
+
var import_main = require("../main");
|
|
25
|
+
var import_logging = require("./logging");
|
|
26
|
+
var import_telegram = require("./telegram");
|
|
27
|
+
var import_utils = require("../lib/utils");
|
|
28
|
+
var import_splitValues = require("../lib/splitValues");
|
|
29
|
+
function getChart(echarts, directoryPicture, user, telegramParams) {
|
|
30
|
+
try {
|
|
31
|
+
for (const echart of echarts) {
|
|
32
|
+
const instanceOfEchart = (0, import_splitValues.getEchartsValues)(echart.preset);
|
|
33
|
+
if (!(0, import_utils.validateDirectory)(import_main.adapter, directoryPicture)) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
import_main.adapter.sendTo(
|
|
37
|
+
instanceOfEchart,
|
|
38
|
+
{
|
|
39
|
+
preset: echart.preset,
|
|
40
|
+
renderer: "jpg",
|
|
41
|
+
background: echart.background,
|
|
42
|
+
theme: echart.theme,
|
|
43
|
+
quality: 1,
|
|
44
|
+
fileOnDisk: directoryPicture + echart.filename
|
|
45
|
+
},
|
|
46
|
+
async (result) => {
|
|
47
|
+
const textToSend = result.error || directoryPicture + echart.filename;
|
|
48
|
+
await (0, import_telegram.sendToTelegram)({ userToSend: user, textToSend, telegramParams });
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
} catch (e) {
|
|
53
|
+
(0, import_logging.errorLogger)("Error in Echart:", e, import_main.adapter);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
+
0 && (module.exports = {
|
|
58
|
+
getChart
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=echarts.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/app/echarts.ts"],
|
|
4
|
+
"sourcesContent": ["import { adapter } from '../main';\nimport { errorLogger } from './logging';\nimport { sendToTelegram } from './telegram';\nimport type { Echart, TelegramParams } from '../types/types';\nimport { validateDirectory } from '../lib/utils';\nimport { getEchartsValues } from '../lib/splitValues';\n\nexport function getChart(\n echarts: Echart[],\n directoryPicture: string,\n user: string,\n telegramParams: TelegramParams,\n): void {\n try {\n for (const echart of echarts) {\n const instanceOfEchart = getEchartsValues(echart.preset);\n\n if (!validateDirectory(adapter, directoryPicture)) {\n return;\n }\n adapter.sendTo(\n instanceOfEchart,\n {\n preset: echart.preset,\n renderer: 'jpg',\n background: echart.background,\n theme: echart.theme,\n quality: 1.0,\n fileOnDisk: directoryPicture + echart.filename,\n },\n async (result: any) => {\n const textToSend = result.error || directoryPicture + echart.filename;\n\n await sendToTelegram({ userToSend: user, textToSend, telegramParams });\n },\n );\n }\n } catch (e: any) {\n errorLogger('Error in Echart:', e, adapter);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AACxB,qBAA4B;AAC5B,sBAA+B;AAE/B,mBAAkC;AAClC,yBAAiC;AAE1B,SAAS,SACZ,SACA,kBACA,MACA,gBACI;AACJ,MAAI;AACA,eAAW,UAAU,SAAS;AAC1B,YAAM,uBAAmB,qCAAiB,OAAO,MAAM;AAEvD,UAAI,KAAC,gCAAkB,qBAAS,gBAAgB,GAAG;AAC/C;AAAA,MACJ;AACA,0BAAQ;AAAA,QACJ;AAAA,QACA;AAAA,UACI,QAAQ,OAAO;AAAA,UACf,UAAU;AAAA,UACV,YAAY,OAAO;AAAA,UACnB,OAAO,OAAO;AAAA,UACd,SAAS;AAAA,UACT,YAAY,mBAAmB,OAAO;AAAA,QAC1C;AAAA,QACA,OAAO,WAAgB;AACnB,gBAAM,aAAa,OAAO,SAAS,mBAAmB,OAAO;AAE7D,oBAAM,gCAAe,EAAE,YAAY,MAAM,YAAY,eAAe,CAAC;AAAA,QACzE;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ,SAAS,GAAQ;AACb,oCAAY,oBAAoB,GAAG,mBAAO;AAAA,EAC9C;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var getstate_exports = {};
|
|
20
|
+
__export(getstate_exports, {
|
|
21
|
+
getState: () => getState
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getstate_exports);
|
|
24
|
+
var import_telegram = require("./telegram");
|
|
25
|
+
var import_action = require("./action");
|
|
26
|
+
var import_jsonTable = require("./jsonTable");
|
|
27
|
+
var import_utilities = require("../lib/utilities");
|
|
28
|
+
var import_utils = require("../lib/utils");
|
|
29
|
+
var import_main = require("../main");
|
|
30
|
+
var import_time = require("../lib/time");
|
|
31
|
+
var import_string = require("../lib/string");
|
|
32
|
+
var import_appUtils = require("../lib/appUtils");
|
|
33
|
+
var import_config = require("../config/config");
|
|
34
|
+
var import_logging = require("./logging");
|
|
35
|
+
async function getState(part, userToSend, telegramParams) {
|
|
36
|
+
var _a;
|
|
37
|
+
try {
|
|
38
|
+
const parse_mode = (_a = part.getData) == null ? void 0 : _a[0].parse_mode;
|
|
39
|
+
const valueArrayForCorrectOrder = [];
|
|
40
|
+
const promises = (part.getData || []).map(async ({ newline, text, id }, index) => {
|
|
41
|
+
var _a2;
|
|
42
|
+
import_main.adapter.log.debug(`Get Value ID: ${id}`);
|
|
43
|
+
if (id.includes(import_config.config.functionSelektor)) {
|
|
44
|
+
await (0, import_action.idBySelector)({
|
|
45
|
+
selector: id,
|
|
46
|
+
text,
|
|
47
|
+
userToSend,
|
|
48
|
+
newline,
|
|
49
|
+
telegramParams
|
|
50
|
+
});
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (text.includes(import_config.config.binding.start)) {
|
|
54
|
+
await (0, import_action.bindingFunc)(text, userToSend, telegramParams, parse_mode);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const state = await import_main.adapter.getForeignStateAsync(id);
|
|
58
|
+
if (!(0, import_utils.isDefined)(state)) {
|
|
59
|
+
import_main.adapter.log.error("The state is empty!");
|
|
60
|
+
valueArrayForCorrectOrder[index] = "N/A";
|
|
61
|
+
return Promise.resolve();
|
|
62
|
+
}
|
|
63
|
+
const stateValue = (0, import_string.cleanUpString)((_a2 = state.val) == null ? void 0 : _a2.toString());
|
|
64
|
+
let modifiedStateVal = stateValue;
|
|
65
|
+
let modifiedTextToSend = text;
|
|
66
|
+
if (text.includes(import_config.config.timestamp.ts) || text.includes(import_config.config.timestamp.lc)) {
|
|
67
|
+
modifiedTextToSend = await (0, import_utilities.processTimeIdLc)(text, id);
|
|
68
|
+
modifiedStateVal = "";
|
|
69
|
+
}
|
|
70
|
+
if (modifiedTextToSend.includes(import_config.config.time)) {
|
|
71
|
+
modifiedTextToSend = (0, import_time.integrateTimeIntoText)(modifiedTextToSend, stateValue);
|
|
72
|
+
modifiedStateVal = "";
|
|
73
|
+
}
|
|
74
|
+
if (modifiedTextToSend.includes(import_config.config.math.start)) {
|
|
75
|
+
const { textToSend, calculated, error: error2 } = (0, import_appUtils.calcValue)(modifiedTextToSend, modifiedStateVal, import_main.adapter);
|
|
76
|
+
if (!error2) {
|
|
77
|
+
modifiedTextToSend = textToSend;
|
|
78
|
+
modifiedStateVal = calculated;
|
|
79
|
+
import_main.adapter.log.debug(`TextToSend: ${modifiedTextToSend} val: ${modifiedStateVal}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (modifiedTextToSend.includes(import_config.config.round.start)) {
|
|
83
|
+
const { error: error2, text: text2, roundedValue } = (0, import_appUtils.roundValue)(String(modifiedStateVal), modifiedTextToSend);
|
|
84
|
+
if (!error2) {
|
|
85
|
+
import_main.adapter.log.debug(`Rounded from ${(0, import_string.jsonString)(modifiedStateVal)} to ${(0, import_string.jsonString)(roundedValue)}`);
|
|
86
|
+
modifiedStateVal = roundedValue;
|
|
87
|
+
modifiedTextToSend = text2;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (modifiedTextToSend.includes(import_config.config.json.start)) {
|
|
91
|
+
const { substring } = (0, import_string.decomposeText)(modifiedTextToSend, import_config.config.json.start, import_config.config.json.end);
|
|
92
|
+
if (substring.includes(import_config.config.json.textTable)) {
|
|
93
|
+
const result = (0, import_jsonTable.createTextTableFromJson)(stateValue, modifiedTextToSend);
|
|
94
|
+
if (result) {
|
|
95
|
+
await (0, import_telegram.sendToTelegram)({
|
|
96
|
+
userToSend,
|
|
97
|
+
textToSend: result,
|
|
98
|
+
telegramParams,
|
|
99
|
+
parse_mode
|
|
100
|
+
});
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
import_main.adapter.log.debug("Cannot create a Text-Table");
|
|
104
|
+
} else {
|
|
105
|
+
const result = (0, import_jsonTable.createKeyboardFromJson)(stateValue, modifiedTextToSend, id, userToSend);
|
|
106
|
+
if (stateValue && stateValue.length > 0) {
|
|
107
|
+
if (result && result.text && result.keyboard) {
|
|
108
|
+
(0, import_telegram.sendToTelegramSubmenu)(userToSend, result.text, result.keyboard, telegramParams, parse_mode);
|
|
109
|
+
}
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
await (0, import_telegram.sendToTelegram)({
|
|
113
|
+
userToSend,
|
|
114
|
+
textToSend: "The state is empty!",
|
|
115
|
+
telegramParams,
|
|
116
|
+
parse_mode
|
|
117
|
+
});
|
|
118
|
+
import_main.adapter.log.debug("The state is empty!");
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const {
|
|
123
|
+
newValue: _val,
|
|
124
|
+
textToSend: _text,
|
|
125
|
+
error
|
|
126
|
+
} = (0, import_string.getValueToExchange)(import_main.adapter, modifiedTextToSend, modifiedStateVal);
|
|
127
|
+
modifiedStateVal = String(_val);
|
|
128
|
+
modifiedTextToSend = _text;
|
|
129
|
+
import_main.adapter.log.debug(!error ? `Value Changed to: ${modifiedTextToSend}` : `No Change`);
|
|
130
|
+
const isNewline = (0, import_string.getNewline)(newline);
|
|
131
|
+
valueArrayForCorrectOrder[index] = modifiedTextToSend.includes(import_config.config.rowSplitter) ? `${modifiedTextToSend.replace(import_config.config.rowSplitter, modifiedStateVal.toString())}${isNewline}` : `${modifiedTextToSend} ${modifiedStateVal} ${isNewline}`;
|
|
132
|
+
});
|
|
133
|
+
await Promise.all(promises);
|
|
134
|
+
await (0, import_telegram.sendToTelegram)({
|
|
135
|
+
userToSend,
|
|
136
|
+
textToSend: valueArrayForCorrectOrder.join(""),
|
|
137
|
+
telegramParams,
|
|
138
|
+
parse_mode
|
|
139
|
+
});
|
|
140
|
+
} catch (error) {
|
|
141
|
+
(0, import_logging.errorLogger)("Error GetData:", error, import_main.adapter);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
145
|
+
0 && (module.exports = {
|
|
146
|
+
getState
|
|
147
|
+
});
|
|
148
|
+
//# sourceMappingURL=getstate.js.map
|