iobroker.telegram 3.8.0 → 3.8.2
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 +3 -3
- package/io-package.json +14 -14
- package/main.js +13 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,6 +37,9 @@ Use telegram service to communicate with ioBroker
|
|
|
37
37
|
Placeholder for the next version (at the beginning of the line):
|
|
38
38
|
### **WORK IN PROGRESS**
|
|
39
39
|
-->
|
|
40
|
+
### 3.8.2 (2024-07-16)
|
|
41
|
+
* (bluefox) Username can consist of more than one user. The separator is comma, semicolon or space.
|
|
42
|
+
|
|
40
43
|
### 3.8.0 (2024-07-14)
|
|
41
44
|
* (bluefox) Migrated GUI for Admin 7
|
|
42
45
|
|
|
@@ -53,9 +56,6 @@ Use telegram service to communicate with ioBroker
|
|
|
53
56
|
* (klein0r) Added option to send status updates to specific users
|
|
54
57
|
* (klein0r) Added states for thread id (of supergroups)
|
|
55
58
|
|
|
56
|
-
### 3.5.3 (2024-06-18)
|
|
57
|
-
* (foxriver76) escape all unallowed characters when sending with notification manager
|
|
58
|
-
|
|
59
59
|
## License
|
|
60
60
|
|
|
61
61
|
The MIT License (MIT)
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "telegram",
|
|
4
|
-
"version": "3.8.
|
|
4
|
+
"version": "3.8.2",
|
|
5
5
|
"news": {
|
|
6
|
+
"3.8.2": {
|
|
7
|
+
"en": "Username can consist of more than one user. The separator is comma, semicolon or space.",
|
|
8
|
+
"de": "Benutzername kann aus mehr als einem Benutzer bestehen. Der Separator ist Komma, Semikolon oder Raum.",
|
|
9
|
+
"ru": "Имя пользователя может состоять из нескольких пользователей. Сепаратор - комма, полуколон или пространство.",
|
|
10
|
+
"pt": "O nome de usuário pode consistir em mais de um usuário. O separador é vírgula, vírgula ou espaço.",
|
|
11
|
+
"nl": "Gebruikersnaam kan bestaan uit meer dan één gebruiker. De scheiding is komma, puntkomma of ruimte.",
|
|
12
|
+
"fr": "Nom d'utilisateur peut se composer de plus d'un utilisateur. Le séparateur est virgule, semi-colon ou espace.",
|
|
13
|
+
"it": "Il nome utente può essere composto da più di un utente. Il separatore è virgola, virgola o spazio.",
|
|
14
|
+
"es": "El nombre de usuario puede consistir en más de un usuario. El separador es coma, ymicolon o espacio.",
|
|
15
|
+
"pl": "Nazwa użytkownika może zawierać więcej niż jednego użytkownika. Separator to przecinek, średnik lub przestrzeń.",
|
|
16
|
+
"uk": "Ім'я користувача може містити більше одного користувача. Сепаратор - кома, напівколон або простір.",
|
|
17
|
+
"zh-cn": "用户名可以由多个用户组成. 分隔符是逗号,分号或空格."
|
|
18
|
+
},
|
|
6
19
|
"3.8.0": {
|
|
7
20
|
"en": "Migrated GUI for Admin 7",
|
|
8
21
|
"de": "Migrated GUI für Admin 7",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "(foxriver76) uniknąć więcej niedozwolonych znaków podczas wysyłania z menedżerem powiadomień",
|
|
81
94
|
"uk": "(foxriver76) втекти більше незрівняних символів при надсиланні повідомлення менеджера",
|
|
82
95
|
"zh-cn": "(foxriver76) 与通知管理器发送时, 逃脱更多未分配字符"
|
|
83
|
-
},
|
|
84
|
-
"3.5.1": {
|
|
85
|
-
"en": "(klein0r) Fixed file handling for voice files\n(klein0r) Updated dependencies",
|
|
86
|
-
"de": "(klein0r) Fixed-Dateihandling für Sprachdateien\n(klein0r) Aktualisierte Abhängigkeiten",
|
|
87
|
-
"ru": "(клеин0р) Исправленная обработка файлов для голосовых файлов\n(клеин0р) Обновленные зависимости",
|
|
88
|
-
"pt": "(klein0r) Manipulação de arquivos fixos para arquivos de voz\n(klein0r) Dependências atualizadas",
|
|
89
|
-
"nl": "(klein0r) Vaste bestandsbehandeling voor spraakbestanden\n(klein0r) Bijgewerkte afhankelijkheden",
|
|
90
|
-
"fr": "(klein0r) Gestion des fichiers fixes pour les fichiers vocaux\n(klein0r) Dépendances actualisées",
|
|
91
|
-
"it": "(Klein0r) Gestione file fisso per file vocali\n(Klein0r) Dipendenze aggiornate",
|
|
92
|
-
"es": "(klein0r) Manejo de archivos fijo para archivos de voz\n(klein0r) Dependencias actualizadas",
|
|
93
|
-
"pl": "(klein0r) Naprawiono obsługę plików głosowych\n(klein0r) Aktualizacja zależności",
|
|
94
|
-
"uk": "(klein0r) Виправлена обробка файлів для голосових файлів\n(klein0r) Оновлені залежності",
|
|
95
|
-
"zh-cn": "(鸣笛0r) 语音文件的固定文件处理\n(鸣笛0r) 更新的依赖关系"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"messages": [
|
package/main.js
CHANGED
|
@@ -58,7 +58,7 @@ function startAdapter(options) {
|
|
|
58
58
|
name: adapterName,
|
|
59
59
|
/**
|
|
60
60
|
* If the JS-Controller catches an unhandled error, this will be called
|
|
61
|
-
* so we have a chance to handle it
|
|
61
|
+
* so we have a chance to handle it ourselves.
|
|
62
62
|
* @param {Error} err
|
|
63
63
|
*/
|
|
64
64
|
error: (err) => {
|
|
@@ -150,7 +150,7 @@ function startAdapter(options) {
|
|
|
150
150
|
err && adapter.log.error(err);
|
|
151
151
|
adapter.log.error('Cannot wipe list of saved users!');
|
|
152
152
|
}
|
|
153
|
-
} else if(obj.command === 'sendNotification') {
|
|
153
|
+
} else if (obj.command === 'sendNotification') {
|
|
154
154
|
processNotification(obj);
|
|
155
155
|
} else{
|
|
156
156
|
processMessage(obj);
|
|
@@ -291,7 +291,7 @@ function startAdapter(options) {
|
|
|
291
291
|
isConnected = false;
|
|
292
292
|
});
|
|
293
293
|
|
|
294
|
-
// is called if a subscribed state changes
|
|
294
|
+
// This handler is called if a subscribed state changes
|
|
295
295
|
adapter.on('stateChange', async (id, state) => {
|
|
296
296
|
if (state) {
|
|
297
297
|
if (!state.ack) {
|
|
@@ -845,13 +845,14 @@ function executeSending(action, options, resolve){
|
|
|
845
845
|
options = null;
|
|
846
846
|
// return all the collected message ids to the callback
|
|
847
847
|
resolve(JSON.stringify(messageIds));
|
|
848
|
-
})
|
|
848
|
+
})
|
|
849
|
+
.catch(error => {
|
|
849
850
|
// add the error to the message ids object
|
|
850
851
|
messageIds.error = {[options.chat_id ? options.chat_id : options.chatId] : error};
|
|
851
852
|
// log error to the system
|
|
852
853
|
adapter.log.error(`Failed sending [${options.chatId ? 'chatId' : 'user'} - ${options.chatId ? options.chatId : options.user}]: ${error}`);
|
|
853
854
|
options = null;
|
|
854
|
-
// send the
|
|
855
|
+
// send the successfully sent messages as callback
|
|
855
856
|
resolve(JSON.stringify(messageIds));
|
|
856
857
|
});
|
|
857
858
|
}
|
|
@@ -908,13 +909,14 @@ function sendMessage(text, user, chatId, options) {
|
|
|
908
909
|
}
|
|
909
910
|
if (chatId) {
|
|
910
911
|
tPromiseList.push(_sendMessageHelper(chatId, 'chat', text, options));
|
|
911
|
-
return Promise.all(tPromiseList)
|
|
912
|
+
return Promise.all(tPromiseList)
|
|
913
|
+
.catch(e => e);
|
|
912
914
|
} else if (user) {
|
|
913
915
|
if (typeof user !== 'string' && !(user instanceof Array)) {
|
|
914
916
|
adapter.log.warn(`Invalid type of user parameter: ${typeof user}. Expected is string or array.`);
|
|
915
917
|
}
|
|
916
918
|
|
|
917
|
-
const userArray = user
|
|
919
|
+
const userArray = Array.isArray(user) ? user : (user || '').toString().split(/[,;\s]/).map(u => u.trim()).filter(u => !!u);
|
|
918
920
|
let matches = 0;
|
|
919
921
|
userArray.forEach(userName => {
|
|
920
922
|
for (const id in users) {
|
|
@@ -938,7 +940,8 @@ function sendMessage(text, user, chatId, options) {
|
|
|
938
940
|
adapter.log.warn(`${userArray.length - matches} of ${userArray.length} recipients are unknown!`);
|
|
939
941
|
}
|
|
940
942
|
|
|
941
|
-
return Promise.all(tPromiseList)
|
|
943
|
+
return Promise.all(tPromiseList)
|
|
944
|
+
.catch(e => e);
|
|
942
945
|
}
|
|
943
946
|
|
|
944
947
|
const m = typeof text === 'string' ? text.match(/^@(.+?)\b/) : null;
|
|
@@ -973,7 +976,8 @@ function sendMessage(text, user, chatId, options) {
|
|
|
973
976
|
});
|
|
974
977
|
}
|
|
975
978
|
|
|
976
|
-
return Promise.all(tPromiseList)
|
|
979
|
+
return Promise.all(tPromiseList)
|
|
980
|
+
.catch(e => e);
|
|
977
981
|
}
|
|
978
982
|
|
|
979
983
|
function saveFile(fileID, fileName, callback) {
|
package/package.json
CHANGED