iobroker.telegram 3.8.1 → 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 +1 -1
- package/io-package.json +2 -2
- package/main.js +8 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ 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.
|
|
40
|
+
### 3.8.2 (2024-07-16)
|
|
41
41
|
* (bluefox) Username can consist of more than one user. The separator is comma, semicolon or space.
|
|
42
42
|
|
|
43
43
|
### 3.8.0 (2024-07-14)
|
package/io-package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "telegram",
|
|
4
|
-
"version": "3.8.
|
|
4
|
+
"version": "3.8.2",
|
|
5
5
|
"news": {
|
|
6
|
-
"3.8.
|
|
6
|
+
"3.8.2": {
|
|
7
7
|
"en": "Username can consist of more than one user. The separator is comma, semicolon or space.",
|
|
8
8
|
"de": "Benutzername kann aus mehr als einem Benutzer bestehen. Der Separator ist Komma, Semikolon oder Raum.",
|
|
9
9
|
"ru": "Имя пользователя может состоять из нескольких пользователей. Сепаратор - комма, полуколон или пространство.",
|
package/main.js
CHANGED
|
@@ -916,7 +916,7 @@ function sendMessage(text, user, chatId, options) {
|
|
|
916
916
|
adapter.log.warn(`Invalid type of user parameter: ${typeof user}. Expected is string or array.`);
|
|
917
917
|
}
|
|
918
918
|
|
|
919
|
-
const userArray = user
|
|
919
|
+
const userArray = Array.isArray(user) ? user : (user || '').toString().split(/[,;\s]/).map(u => u.trim()).filter(u => !!u);
|
|
920
920
|
let matches = 0;
|
|
921
921
|
userArray.forEach(userName => {
|
|
922
922
|
for (const id in users) {
|
|
@@ -1187,20 +1187,16 @@ async function processMessage(obj) {
|
|
|
1187
1187
|
switch (obj.command) {
|
|
1188
1188
|
case 'send':
|
|
1189
1189
|
if (obj.message) {
|
|
1190
|
+
let tPromise;
|
|
1190
1191
|
if (typeof obj.message === 'object') {
|
|
1191
|
-
|
|
1192
|
-
const tPromise = [];
|
|
1193
|
-
for (let i = 0; i < users.length; i++) {
|
|
1194
|
-
tPromise.push(sendMessage(obj.message.text, obj.message?.user, obj.message?.chatId, obj.message));
|
|
1195
|
-
}
|
|
1196
|
-
Promise.all(tPromise)
|
|
1197
|
-
.then(count => obj.callback && adapter.sendTo(obj.from, obj.command, count.length, obj.callback))
|
|
1198
|
-
.catch(e => adapter.log.error(`Cannot send command: ${e}`));
|
|
1192
|
+
tPromise = sendMessage(obj.message.text, obj.message?.user, obj.message?.chatId, obj.message);
|
|
1199
1193
|
} else {
|
|
1200
|
-
sendMessage(obj.message)
|
|
1201
|
-
.then(count => obj.callback && adapter.sendTo(obj.from, obj.command, count.length, obj.callback))
|
|
1202
|
-
.catch(e => adapter.log.error(`Cannot send command: ${e}`));
|
|
1194
|
+
tPromise = sendMessage(obj.message);
|
|
1203
1195
|
}
|
|
1196
|
+
|
|
1197
|
+
tPromise
|
|
1198
|
+
.then(count => obj.callback && adapter.sendTo(obj.from, obj.command, count, obj.callback))
|
|
1199
|
+
.catch(e => adapter.log.error(`Cannot send command: ${e}`));
|
|
1204
1200
|
}
|
|
1205
1201
|
break;
|
|
1206
1202
|
|
package/package.json
CHANGED