iobroker.telegram 1.11.0 → 1.11.1

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 CHANGED
@@ -703,6 +703,9 @@ msg.payload = {
703
703
  -->
704
704
 
705
705
  ## Changelog
706
+ ### 1.11.1 (2022-01-27)
707
+ * (bluefox) fixed the receiving files
708
+
706
709
  ### 1.11.0 (2022-01-26)
707
710
  * (bluefox) Added bruteforce protection
708
711
  * (bluefox) Extended blockly with `disable_web_preview` option
package/io-package.json CHANGED
@@ -1,8 +1,20 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "telegram",
4
- "version": "1.11.0",
4
+ "version": "1.11.1",
5
5
  "news": {
6
+ "1.11.1": {
7
+ "en": "fixed the receiving files",
8
+ "de": "die empfangenen Dateien repariert",
9
+ "ru": "исправлено получение файлов",
10
+ "pt": "corrigiu os arquivos de recebimento",
11
+ "nl": "de ontvangende bestanden gerepareerd",
12
+ "fr": "corrigé les fichiers de réception",
13
+ "it": "corretto i file di ricezione",
14
+ "es": "arregló los archivos de recepción",
15
+ "pl": "naprawiono odbieranie plików",
16
+ "zh-cn": "修复了接收文件"
17
+ },
6
18
  "1.11.0": {
7
19
  "en": "Added bruteforce protection\nExtended blockly with `disable_web_preview` option\nadded `communicate.responseSilent` state to answer silently",
8
20
  "de": "Bruteforce-Schutz hinzugefügt\nBlockweise erweitert mit der Option `disable_web_preview`\n`communicate.responseSilent`-Zustand hinzugefügt, um still zu antworten",
@@ -66,18 +78,6 @@
66
78
  "1.8.2": {
67
79
  "en": "fixed data types",
68
80
  "de": "Datentypen korrigiert"
69
- },
70
- "1.8.1": {
71
- "en": "added the admin5 support",
72
- "de": "Die admin5-Unterstützung wurde hinzugefügt",
73
- "ru": "добавлена поддержка admin5",
74
- "pt": "adicionou o suporte admin5",
75
- "nl": "de admin5-ondersteuning toegevoegd",
76
- "fr": "a ajouté le support admin5",
77
- "it": "aggiunto il supporto admin5",
78
- "es": "agregó el soporte admin5",
79
- "pl": "dodano obsługę admin5",
80
- "zh-cn": "添加了admin5支持"
81
81
  }
82
82
  },
83
83
  "title": "Telegram",
package/main.js CHANGED
@@ -1031,7 +1031,7 @@ function sendMessage(text, user, chatId, options) {
1031
1031
  }
1032
1032
 
1033
1033
  return Promise.all(tPromiseList)
1034
- .then((results) =>
1034
+ .then(results =>
1035
1035
  results.reduce((e, acc) => acc + e, 0))
1036
1036
  .catch(e => -1);
1037
1037
  }
@@ -1044,18 +1044,20 @@ function saveFile(fileID, fileName, callback) {
1044
1044
  if (res.statusCode === 200) {
1045
1045
  const buf = [];
1046
1046
  res.on('data', data => buf.push(data));
1047
- res.on('end', () =>
1048
- fs.writeFile(tmpDirName + fileName, Buffer.concat(buf), true, err => {
1049
- if (err) {
1050
- throw err;
1051
- }
1052
- callback({
1053
- info: 'It\'s saved! : ' + tmpDirName + fileName,
1054
- path: tmpDirName + fileName
1055
- });
1056
- }));
1047
+ res.on('end', () => {
1048
+ try {
1049
+ fs.writeFileSync(tmpDirName + fileName, Buffer.concat(buf));
1050
+ } catch (err) {
1051
+ return callback({error: 'Error: ' + err});
1052
+ }
1053
+
1054
+ callback({
1055
+ info: 'It\'s saved! : ' + tmpDirName + fileName,
1056
+ path: tmpDirName + fileName
1057
+ });
1058
+ });
1057
1059
 
1058
- res.on('error', true, err =>
1060
+ res.on('error', err =>
1059
1061
  callback({error: 'Error: ' + err}));
1060
1062
  } else {
1061
1063
  callback({error: 'Error: statusCode !== 200'});
@@ -1973,7 +1975,7 @@ function connect() {
1973
1975
  async function updateUsers() {
1974
1976
  if (adapter.config.rememberUsers) {
1975
1977
  try {
1976
- const state = await adapter.getState('communicate.users');
1978
+ const state = await adapter.getStateAsync('communicate.users');
1977
1979
  if (state && state.val) {
1978
1980
  try {
1979
1981
  users = JSON.parse(state.val);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "iobroker.telegram",
3
3
  "description": "The adapter allows to send and receive telegram messages from ioBroker and to be a broker.",
4
- "version": "1.11.0",
4
+ "version": "1.11.1",
5
5
  "author": "bluefox <dogafox@gmail.com>",
6
6
  "homepage": "https://github.com/iobroker-community-adapters/ioBroker.telegram",
7
7
  "repository": {