iobroker.telegram 1.8.1 → 1.10.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014-2021 bluefox <dogafox@gmail.com>
3
+ Copyright (c) 2014-2022 bluefox <dogafox@gmail.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,17 +1,19 @@
1
1
  ![Logo](admin/telegram.png)
2
2
  # ioBroker telegram Adapter
3
3
 
4
- ![Number of Installations](http://iobroker.live/badges/telegram-installed.svg) ![Number of Installations](http://iobroker.live/badges/telegram-stable.svg) [![NPM version](http://img.shields.io/npm/v/iobroker.telegram.svg)](https://www.npmjs.com/package/iobroker.telegram)
5
- [![Downloads](https://img.shields.io/npm/dm/iobroker.telegram.svg)](https://www.npmjs.com/package/iobroker.telegram)
6
- [![Tests](https://travis-ci.org/ioBroker/ioBroker.telegram.svg?branch=master)](https://travis-ci.org/ioBroker/ioBroker.telegram)
4
+ ![Number of Installations](http://iobroker.live/badges/telegram-installed.svg)
5
+ ![Number of Installations](http://iobroker.live/badges/telegram-stable.svg)
6
+ [![NPM version](http://img.shields.io/npm/v/iobroker.telegram.svg)](https://www.npmjs.com/package/iobroker.telegram)
7
7
 
8
- [![NPM](https://nodei.co/npm/iobroker.telegram.png?downloads=true)](https://nodei.co/npm/iobroker.telegram/)
8
+ ![Test and Release](https://github.com/iobroker-community-adapters/iobroker.telegram/workflows/Test%20and%20Release/badge.svg)
9
+ [![Translation status](https://weblate.iobroker.net/widgets/adapters/-/telegram/svg-badge.svg)](https://weblate.iobroker.net/engage/adapters/?utm_source=widget)
10
+ [![Downloads](https://img.shields.io/npm/dm/iobroker.telegram.svg)](https://www.npmjs.com/package/iobroker.telegram)
9
11
 
10
12
  ## Configuration
11
13
  Ask [@BotFather](https://telegram.me/botfather) to create new bot ```/newbot```.
12
14
 
13
15
  You will be asked to enter name of the bot and then the username.
14
- After that you will get the Token.
16
+ After that, you will get the Token.
15
17
 
16
18
  ![Screenshot](img/chat.png)
17
19
 
@@ -38,7 +40,7 @@ sendTo('telegram', {user: 'UserName', text: 'Test message'}, function (res) {
38
40
  If you use the example above be aware of that you have to replace 'UserName' with either the first name or the Public-Telegram-Username of the User you want to send the message to. (Depends on if the 'Store username not firstname' setting in the adapter settings is enabled or not)
39
41
  If the option is set and the user did not specify a public username in his telegram account, then the adapter will continue to use the firstname of the user. Keep in mind that if the user sets a public username later (after authenticating to your bot) the saved firstname will be replaced by the username the next time the user sends a message to the bot.
40
42
 
41
- It is possible to specify more than one recipient (just separate the User names by comma).
43
+ It is possible to specify more than one recipient (just separate the usernames by comma).
42
44
  For example: Recipient: "User1,User4,User5"
43
45
 
44
46
  You can send message over state too, just set state *"telegram.INSTANCE.communicate.response"* with value *"@userName Test message"* or with a JSON object:
@@ -49,7 +51,7 @@ You can send message over state too, just set state *"telegram.INSTANCE.communic
49
51
  }
50
52
  ```
51
53
 
52
- The JSON syntax also allows to add options from the [telegram bots API](https://core.telegram.org/bots/api), as well as setting the user or chatId:
54
+ The JSON syntax also allows the adding options from the [telegram bots API](https://core.telegram.org/bots/api), as well as setting the user or chatId:
53
55
 
54
56
  ```
55
57
  {
@@ -60,7 +62,7 @@ The JSON syntax also allows to add options from the [telegram bots API](https://
60
62
  }
61
63
  ```
62
64
 
63
- In order to send messages to groups, you have to invite the bot to the group you want the bot to post in.
65
+ In order to send messages to the groups, you have to invite the bot to the group you want the bot to post in.
64
66
  By providing the `chat_id` to the JSON message payload you can actually send messages to those groups.
65
67
 
66
68
  In order to find out the `chat_id` you have to set the adapter's log level to `debug`.
@@ -73,7 +75,7 @@ You can use telegram with [text2command](https://github.com/ioBroker/ioBroker.te
73
75
 
74
76
  To send a photo, just send a path to file instead of text or URL: `sendTo('telegram', 'absolute/path/file.png')` or `sendTo('telegram', 'https://telegram.org/img/t_logo.png')`.
75
77
 
76
- Example how to send a screen shot from web-cam to telegram:
78
+ Example how to send a screenshot from web-cam to telegram:
77
79
 
78
80
  ```
79
81
  var request = require('request');
@@ -128,7 +130,7 @@ sendTo('telegram.0', {
128
130
  ```
129
131
 
130
132
  **Possible options**:
131
- - *disable_notification*: Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound. (all types)
133
+ - *disable_notification*: Sends the message silently. The iOS users will not receive a notification, Android users will receive a notification with no sound. (all types)
132
134
  - *parse_mode*: Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. Possible values: "Markdown", "MarkdownV2", "HTML" (message)
133
135
  - *disable_web_page_preview*: Disables link previews for links in this message (message)
134
136
  - *caption*: Caption for the document, photo or video, 0-200 characters (video, audio, photo, document)
@@ -224,7 +226,7 @@ Timeout can be set in configuration and by default is 60 seconds.
224
226
  ```
225
227
  sendTo('telegram.0', 'ask', {
226
228
  user: user, // optional
227
- text: 'Aure you sure?',
229
+ text: 'Are you sure?',
228
230
  reply_markup: {
229
231
  inline_keyboard: [
230
232
  // two buttons could be on one line too, but here they are on different
@@ -288,6 +290,50 @@ if (command ==="1_2") {
288
290
 
289
291
  You can read more [here](https://github.com/yagop/node-telegram-bot-api/blob/release/doc/api.md#telegramboteditmessagetexttext-options--promise).
290
292
 
293
+ ### editMessageCaption
294
+ Use this method to edit caption of the message sent by the bot or via the bot (for inline bots).
295
+ On success, if edited message is sent by the bot, the edited Message is returned, otherwise *True* is returned.
296
+
297
+ ```
298
+ if (command === "1_2") {
299
+ sendTo('telegram', {
300
+ user, // optional
301
+ text: 'New caption',
302
+ editMessageCaption: {
303
+ options: {
304
+ chat_id: getState("telegram.0.communicate.requestChatId").val,
305
+ message_id: getState("telegram.0.communicate.requestMessageId").val
306
+ }
307
+ }
308
+ });
309
+ }
310
+ ```
311
+
312
+ You can read more [here](https://github.com/yagop/node-telegram-bot-api/blob/release/doc/api.md#telegramboteditmessagetexttext-options--promise).
313
+
314
+ ### editMessageMedia
315
+ Use this method to edit picture of the message sent by the bot or via the bot (for inline bots).
316
+ On success, if edited message is sent by the bot, the edited Message is returned, otherwise *True* is returned.
317
+
318
+ ```
319
+ if (command === "1_2") {
320
+ sendTo('telegram', {
321
+ user, // optional
322
+ text: 'picture.jpg',
323
+ editMessageMedia: {
324
+ options: {
325
+ chat_id: (await getStateAsync('telegram.0.communicate.botSendChatId')).val,
326
+ message_id: (await getStateAsync('telegram.0.communicate.botSendMessageId')).val
327
+ }
328
+ }
329
+ });
330
+ }
331
+ ```
332
+
333
+ Supported are following media types: `photo`, `animation`, `audio`, `document`, `video`.
334
+
335
+ You can read more [here](https://core.telegram.org/bots/api#editmessagemedia).
336
+
291
337
  ### editMessageReplyMarkup
292
338
  Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise *True* is returned.
293
339
 
@@ -383,7 +429,7 @@ You can set the value of state if you now the ID:
383
429
  ## Polling or Server mode
384
430
  If polling mode is used, the adapter polls by default every 300ms the telegram server for updates. It uses traffic and messages can be delayed for up to the polling interval. The polling interval can be defined in adapter configuration.
385
431
 
386
- To use server mode you ioBroker instance must be reachable from internet (e.g. with noip.com dynamic DNS service).
432
+ To use server mode you ioBroker instance must be reachable from internet (e.g. with `noip.com` dynamic DNS service).
387
433
 
388
434
  Telegram can work only with HTTPS servers, but you can use **let's encrypt** certificates.
389
435
 
@@ -391,11 +437,23 @@ Following settings must be provided for server mode:
391
437
 
392
438
  - URL - in form https://yourdomain.com:8443.
393
439
  - IP - Ip address, where the server will be bound. Default 0.0.0.0. Do not change it if you are not sure.
394
- - Port - actually only 443, 80, 88, 8443 ports are supported by telegram, but you can forward ports to any one through your router.
440
+ - Port - actually only 443, 80, 88, 8443 ports are supported by telegram, but you can forward ports to anyone through your router.
395
441
  - Public certificate - required, if **let's encrypt** is disabled.
396
442
  - Private key - required, if **let's encrypt** is disabled.
397
443
  - Chain certificate (optional)
398
- - Let's encrypt options - It is very easy to setup **let's encrypt** certificates. Please read [here](https://github.com/ioBroker/ioBroker.admin#lets-encrypt-certificates) about it.
444
+ - Let's encrypt options - It is very easy to set up **let's encrypt** certificates. Please read [here](https://github.com/ioBroker/ioBroker.admin#lets-encrypt-certificates) about it.
445
+
446
+ ## Advanced security
447
+ The authentication of users could be disabled. So no one new can authenticate.
448
+
449
+ To create a list of trusted users, first disable the option "Do not authenticate new users" and
450
+ authenticate all users that should be in the trusted list by sending the `/password <PASSWORD>` message.
451
+
452
+ The users, that sent valid password will be stored in the trusted list.
453
+
454
+ After that teh option "Do not authenticate new users" could be activated and no new users can authenticate.
455
+
456
+ To use this option the option "Remember authenticated users" must be activated.
399
457
 
400
458
  ## Calls via telegram
401
459
  Thanks to [callmebot](https://www.callmebot.com/) api, you can make a call to your telegram account and some text will be read via TTS engine.
@@ -537,19 +595,19 @@ For every state the additional settings could be enabled:
537
595
 
538
596
  ![settings](img/stateSettings.png)
539
597
 
540
- By entering "/cmds" the following keyboard will be displayed in telegram:
598
+ By entering `/cmds` the following keyboard will be displayed in telegram:
541
599
 
542
600
  ![settings](img/stateSettings1.png)
543
601
 
544
- "/cmds" could be replaced by any text (e.g. "?") in the configuration dialog of telegram adapter.
602
+ `/cmds` could be replaced by any text (e.g. "?") in the configuration dialog of telegram adapter.
545
603
 
546
604
  If **Use rooms in keyboard command** option is enabled in the configuration dialog of telegram adapter, so in the first step the room list will be shown. ***Not yet implemented***
547
605
 
548
606
  ### Settings in the state
549
- First of all the configuration must be enabled.
607
+ First the configuration must be enabled.
550
608
 
551
609
  #### Alias
552
- Name of the device. If empty the name will be taken from object.
610
+ Name of the device. If the name is empty, the name will be taken from object.
553
611
  By entering "Door lamp" following menu will be shown for boolean state.
554
612
  ![settings](img/stateSettings2.png)
555
613
 
@@ -557,10 +615,10 @@ You can switch the device ON, turn the device OFF or request the state.
557
615
  If you Click `Door lamp ?`, you will get `Door lamp => switched off`.
558
616
 
559
617
  ### Read only
560
- If activated, no ON/OFF buttons will be shown, just a `Door lamp ?`.
618
+ If activated, ON/OFF buttons will be not shown, just a `Door lamp ?`.
561
619
 
562
620
  ### Report changes
563
- If the status of device changed (e.g. some one turned the lamp on physically), the new status will be delivered to telegram.
621
+ If the status of device changed (e.g. someone turned the lamp on physically), the new status will be delivered to telegram.
564
622
  E.g. `Door lamp => switched on`.
565
623
 
566
624
  ### Buttons in line
@@ -570,7 +628,7 @@ Because of the long name maybe it is better to show only 2 (or even just one) bu
570
628
  ![settings](img/stateSettings3.png)
571
629
 
572
630
  ### Write only
573
- If activated, no the status query (`Door lamp ?`) button will be shown.
631
+ If activated, the status query (`Door lamp ?`) button will be not shown.
574
632
  ![settings](img/stateSettings4.png)
575
633
 
576
634
  ### ON Command
@@ -582,7 +640,7 @@ Will produce following keyboard:
582
640
  ![settings](img/stateSettings6.png)
583
641
 
584
642
  ### ON Text
585
- Which text will be shown by state report.
643
+ The text, that will be shown by state report.
586
644
  E.g. `Door lamp => activated` if the state of the device changed to true and the **ON Text** is `activated`
587
645
 
588
646
  The ON/OFF Texts will be shown only if **Report changes** is activated.
@@ -595,13 +653,13 @@ Same as **ON Text**, but for OFF.
595
653
  E.g. `Door lamp => deactivated` if the state of the device changed to false and the **OFF Text** is `deactivated`
596
654
 
597
655
  ### Only true
598
- E.g. for buttons, they have no OFF state. In this case no OFF button will be shown.
656
+ E.g. for buttons, they have no OFF state. In this case the OFF button will be not shown.
599
657
 
600
658
  ![settings](img/stateSettings7.png)
601
659
 
602
660
  ## How to receive messages in group chats using telegram adapter
603
661
  If telegram bot receives messages sent by user to the bot in private chats, but not receives messages sent by users in group chats.
604
- In this case you must talk to @botfather and disable the privacy mode.
662
+ In this case you must talk to `@botfather` and disable the privacy mode.
605
663
 
606
664
  BotFather chat:
607
665
 
@@ -625,16 +683,16 @@ BotFather: Success! The new status is: DISABLED. /help
625
683
 
626
684
  ## How to send messages via node-red
627
685
  For simple text messages to all users, just put the text within the payload of the message and
628
- send it to the ioBroker state *"telegram.INSTANCE.communicate.response"*.
686
+ send it to the ioBroker state `telegram.INSTANCE.communicate.response`.
629
687
 
630
688
  If you want to set additional options, fill the payload with a JSON object, such as:
631
689
  ```
632
690
  msg.payload = {
633
- /* text is the only mandatory field here */
691
+ // text is the only mandatory field here
634
692
  "text": "*bold _italic bold ~italic bold strikethrough~ __underline italic bold___ bold*",
635
- /* optional chatId or user, the receipient of the message */
693
+ // optional chatId or user, the recipient of the message
636
694
  "chatId": "1234567890",
637
- /* optional settings from the telegram bots API */
695
+ // optional settings from the telegram bots API
638
696
  "parse_mode": "MarkdownV2"
639
697
  }
640
698
  ```
@@ -645,6 +703,29 @@ msg.payload = {
645
703
  -->
646
704
 
647
705
  ## Changelog
706
+ ### 1.10.1 (2022-01-26)
707
+ * (bluefox) Updated telegram library
708
+
709
+ ### 1.10.0 (2021-07-30)
710
+ * (PeterVoronov) Add botSendRaw state to allow processing of the RAW data send by bot
711
+ * (Apollon77) Add tier for js-controller 3.3
712
+ * (bluefox) Fixed the control of the states
713
+
714
+ ### 1.9.0 (2021-06-26)
715
+ * (bluefox) Added the option to not authenticate the new users
716
+ * (bluefox) Added the option to disable system messages for specific users
717
+
718
+ ### 1.8.3 (2021-06-26)
719
+ * (Nahasapeemapetilon) corrected bug with many simultaneous requests
720
+ * (bluefox) formatting
721
+ * (bluefox) implemented editMessageMedia and editMessageCaption
722
+ * (bluefox) Encrypt token
723
+ * (bluefox) Corrected error with password
724
+ * (bluefox) Corrected error with boolean easy controls
725
+
726
+ ### 1.8.2 (2021-05-28)
727
+ * (Diginix) fixed data types
728
+
648
729
  ### 1.8.1 (2021-04-20)
649
730
  * (bluefox) added the admin5 support
650
731
 
@@ -668,7 +749,7 @@ msg.payload = {
668
749
 
669
750
  ### 1.5.9 (2020-05-04)
670
751
  * (Apollon77) potential error fixed when sending messages
671
- * (Apollon77) webserver initialization optimized again to prevent errors with invalid certificates
752
+ * (Apollon77) webserver initialization optimized again to prevent errors with invalid certificates
672
753
 
673
754
  ### 1.5.8 (2020-04-30)
674
755
  * (Apollon77) errors on webserver initialization are handled properly
@@ -678,11 +759,11 @@ msg.payload = {
678
759
  * (bluefox) Added description of easy-keyboard
679
760
 
680
761
  ### 1.5.5 (2020-04-04)
681
- * (alutov) Fixed bug for telegram users with an empty user name
682
- * (Mark Rohrbacher) Allowed JSON objects in telegram.*.communicate.response
762
+ * (alutov) Fixed bug for telegram users with an empty username
763
+ * (Mark Rohrbacher) Allowed JSON objects in telegram.*.communicate.response
683
764
 
684
765
  ### 1.5.4 (2020-03-11)
685
- * (bluefox) Improvement of callmebot
766
+ * (bluefox) Improvement of `callmebot`
686
767
 
687
768
  ### 1.5.3 (2020-02-23)
688
769
  * (foxriver76) removed usage of adapter.objects
@@ -692,7 +773,7 @@ msg.payload = {
692
773
  * (bluefox) Invalid parameters were checked
693
774
 
694
775
  ### 1.5.0 (2020-02-03)
695
- * (bluefox) Added voice calls
776
+ * (bluefox) Added voice calls
696
777
 
697
778
  ### 1.4.7 (2019-12-27)
698
779
  * (Apollon77) Make compatible with js-controller 2.3
@@ -707,7 +788,7 @@ msg.payload = {
707
788
  * (BuZZy1337) Bugfix for not yet completely implemented feature
708
789
 
709
790
  ### 1.4.2 (2019-02-18)
710
- * (BuZZy1337) fix for recipients containing withespaces
791
+ * (BuZZy1337) fix for recipients containing spaces
711
792
  * (BuZZy1337) change loglevel of "getMe" info-messages to debug
712
793
  * (bluefox) fix scroll in firefox
713
794
 
@@ -737,7 +818,7 @@ msg.payload = {
737
818
 
738
819
  ### 1.3.0 (2018-09-19)
739
820
  * (BuZZy1337) Added possibility to delete authenticated users in the Adapter-Config screen (via Messages tab)
740
- * (BuZZy1337) fixed a problem "building" the Blockly sendto block when no adapter instance exists.
821
+ * (BuZZy1337) fixed a problem "building" the Blockly `sendto` block when no adapter instance exists.
741
822
 
742
823
  ### 1.2.7 (2018-08-29)
743
824
  * (BuZZy1337) Added "disable notification" checkbox to blockly block.
@@ -788,7 +869,7 @@ msg.payload = {
788
869
  * (Haba) Updating for Admin3
789
870
 
790
871
  ### 1.0.9 (2017-11-27)
791
- * (kirovilya) Allow send gif via sendDocument
872
+ * (kirovilya) Allow the sending of GIF via sendDocument
792
873
 
793
874
  ### 1.0.8 (2017-10-03)
794
875
  * (Haba1234) initPolling() this is deprecated. -> startPolling()
@@ -834,7 +915,7 @@ msg.payload = {
834
915
  * (bluefox) add new states: requestChatId and requestUserId
835
916
 
836
917
  ### 0.4.0 (2016-07-21)
837
- * (bluefox) allow send messages to chats via chat-ID
918
+ * (bluefox) allow sending of messages to chats via chat-ID
838
919
  * (bluefox) support of video(mp4), audio, document, location, sticker, action
839
920
 
840
921
  ### 0.3.0 (2016-05-31)
@@ -863,13 +944,13 @@ msg.payload = {
863
944
  * (bluefox) fix error with sendTo
864
945
 
865
946
  ### 0.0.1 (2016-02-13)
866
- * (bluefox) intial commit
947
+ * (bluefox) initial commit
867
948
 
868
949
  ## License
869
950
 
870
951
  The MIT License (MIT)
871
952
 
872
- Copyright (c) 2016-2021, bluefox <dogafox@gmail.com>
953
+ Copyright (c) 2016-2022, bluefox <dogafox@gmail.com>
873
954
 
874
955
  Permission is hereby granted, free of charge, to any person obtaining a copy
875
956
  of this software and associated documentation files (the "Software"), to deal
package/admin/blockly.js CHANGED
@@ -17,17 +17,18 @@ Blockly.Translate = Blockly.Translate || function (word, lang) {
17
17
  };
18
18
 
19
19
  // --- SendTo telegram --------------------------------------------------
20
- Blockly.Words['telegram'] = {'en': 'telegram', 'pt': 'telegram', 'pl': 'telegram', 'nl': 'telegram', 'it': 'telegram', 'es': 'telegram', 'fr': 'telegram', 'de': 'telegram', 'ru': 'telegram'};
21
- Blockly.Words['telegram_message'] = {'en': 'message', 'pt': 'mensagem', 'pl': 'wiadomość', 'nl': 'bericht', 'it': 'Messaggio', 'es': 'mensaje', 'fr': 'message', 'de': 'Meldung', 'ru': 'сообщение'};
22
- Blockly.Words['telegram_username'] = {'en': 'Recipient (optional)', 'pt': 'Nome do usuário (opcional)', 'pl': 'Nazwa użytkownika (opcjonalnie)', 'nl': 'Gebruikersnaam (optioneel)', 'it': 'Nome utente (facoltativo)', 'es': 'Nombre de usuario (opcional)', 'fr': 'Nom d\'utilisateur (facultatif)', 'de': 'Empfänger (optional)', 'ru': 'имя пользователя (не обяз.)'};
23
- Blockly.Words['telegram_anyInstance'] = {'en': 'all instances', 'pt': 'todas as instâncias', 'pl': 'wszystkie przypadki', 'nl': 'alle instanties', 'it': 'tutte le istanze', 'es': 'todas las instancias', 'fr': 'toutes les instances', 'de': 'Alle Instanzen', 'ru': 'На все драйвера'};
24
- Blockly.Words['telegram_tooltip'] = {'en': 'Send message to telegram', 'pt': 'Enviar mensagem para telegrama', 'pl': 'Wyślij wiadomość do telegramu', 'nl': 'Stuur bericht naar telegram', 'it': 'Invia messaggio al telegramma', 'es': 'Enviar mensaje al telegrama', 'fr': 'Envoyer un message au télégramme', 'de': 'Sende eine Meldung über Telegram', 'ru': 'Послать сообщение через Telegram'};
25
- Blockly.Words['telegram_log'] = {'en': 'log level', 'pt': 'nível de log', 'pl': 'poziom dziennika', 'nl': 'Log niveau', 'it': 'livello log', 'es': 'nivel de registro', 'fr': 'niveau de journalisation', 'de': 'Loglevel', 'ru': 'Протокол'};
26
- Blockly.Words['telegram_log_none'] = {'en': 'none', 'pt': 'Nenhum', 'pl': 'Żaden', 'nl': 'geen', 'it': 'nessuna', 'es': 'ninguna', 'fr': 'aucun', 'de': 'keins', 'ru': 'нет'};
27
- Blockly.Words['telegram_log_info'] = {'en': 'info', 'pt': 'info', 'pl': 'informacje', 'nl': 'Info', 'it': 'Informazioni', 'es': 'información', 'fr': 'Info', 'de': 'info', 'ru': 'инфо'};
28
- Blockly.Words['telegram_log_debug'] = {'en': 'debug', 'pt': 'depurar', 'pl': 'odpluskwić', 'nl': 'Debug', 'it': 'Debug', 'es': 'depurar', 'fr': 'déboguer', 'de': 'debug', 'ru': 'debug'};
29
- Blockly.Words['telegram_log_warn'] = {'en': 'warning', 'pt': 'Atenção', 'pl': 'ostrzeżenie', 'nl': 'waarschuwing', 'it': 'avvertimento', 'es': 'advertencia', 'fr': 'Attention', 'de': 'warning', 'ru': 'warning'};
30
- Blockly.Words['telegram_log_error'] = {'en': 'error', 'pt': 'erro', 'pl': 'błąd', 'nl': 'fout', 'it': 'errore', 'es': 'error', 'fr': 'Erreur', 'de': 'error', 'ru': 'ошибка'};
20
+ Blockly.Words['telegram'] = {'en': 'telegram', 'pt': 'telegram', 'pl': 'telegram', 'nl': 'telegram', 'it': 'telegram', 'es': 'telegram', 'fr': 'telegram', 'de': 'telegram', 'ru': 'telegram'};
21
+ Blockly.Words['telegram_message'] = {'en': 'message', 'pt': 'mensagem', 'pl': 'wiadomość', 'nl': 'bericht', 'it': 'Messaggio', 'es': 'mensaje', 'fr': 'message', 'de': 'Meldung', 'ru': 'сообщение'};
22
+ Blockly.Words['telegram_username'] = {'en': 'Recipient (Username, optional)', 'pt': 'Destinatário (nome de usuário, opcional)', 'de': 'Empfänger (Benutzername, optional)', 'ru': 'Получатель (имя пользователя, необязательно)', 'nl': 'Ontvanger (gebruikersnaam, optioneel)', 'fr': 'Destinataire (nom d\'utilisateur, facultatif)', 'it': 'Destinatario (Nome utente, facoltativo)', 'es': 'Destinatario (nombre de usuario, opcional)', 'pl': 'Odbiorca (nazwa użytkownika, opcjonalnie)', 'zh-cn': '收件人(用户名,可选)' };
23
+ Blockly.Words['telegram_chatid'] = {'en': 'Recipient (Chat-ID, optional)', 'de': 'Empfänger (Chat-ID, optional)', 'ru': 'Получатель (Chat-ID, необязательно)', 'pt': 'Destinatário (Chat-ID, opcional)', 'nl': 'Ontvanger (Chat-ID, optioneel)', 'fr': 'Destinataire (Chat-ID, facultatif)', 'it': 'Destinatario (ID chat, facoltativo)', 'es': 'Destinatario (Chat-ID, opcional)', 'pl': 'Odbiorca (identyfikator czatu, opcjonalnie)', 'zh-cn': '收件人(聊天 ID,可选)' };
24
+ Blockly.Words['telegram_anyInstance'] = {'en': 'all instances', 'pt': 'todas as instâncias', 'pl': 'wszystkie przypadki', 'nl': 'alle instanties', 'it': 'tutte le istanze', 'es': 'todas las instancias', 'fr': 'toutes les instances', 'de': 'Alle Instanzen', 'ru': 'На все драйвера'};
25
+ Blockly.Words['telegram_tooltip'] = {'en': 'Send message to telegram', 'pt': 'Enviar mensagem para telegrama', 'pl': 'Wyślij wiadomość do telegramu', 'nl': 'Stuur bericht naar telegram', 'it': 'Invia messaggio al telegramma', 'es': 'Enviar mensaje al telegrama', 'fr': 'Envoyer un message au télégramme', 'de': 'Sende eine Meldung über Telegram', 'ru': 'Послать сообщение через Telegram'};
26
+ Blockly.Words['telegram_log'] = {'en': 'log level', 'pt': 'nível de log', 'pl': 'poziom dziennika', 'nl': 'Log niveau', 'it': 'livello log', 'es': 'nivel de registro', 'fr': 'niveau de journalisation', 'de': 'Loglevel', 'ru': 'Протокол'};
27
+ Blockly.Words['telegram_log_none'] = {'en': 'none', 'pt': 'Nenhum', 'pl': 'Żaden', 'nl': 'geen', 'it': 'nessuna', 'es': 'ninguna', 'fr': 'aucun', 'de': 'keins', 'ru': 'нет'};
28
+ Blockly.Words['telegram_log_info'] = {'en': 'info', 'pt': 'info', 'pl': 'informacje', 'nl': 'Info', 'it': 'Informazioni', 'es': 'información', 'fr': 'Info', 'de': 'info', 'ru': 'инфо'};
29
+ Blockly.Words['telegram_log_debug'] = {'en': 'debug', 'pt': 'depurar', 'pl': 'odpluskwić', 'nl': 'Debug', 'it': 'Debug', 'es': 'depurar', 'fr': 'déboguer', 'de': 'debug', 'ru': 'debug'};
30
+ Blockly.Words['telegram_log_warn'] = {'en': 'warning', 'pt': 'Atenção', 'pl': 'ostrzeżenie', 'nl': 'waarschuwing', 'it': 'avvertimento', 'es': 'advertencia', 'fr': 'Attention', 'de': 'warning', 'ru': 'warning'};
31
+ Blockly.Words['telegram_log_error'] = {'en': 'error', 'pt': 'erro', 'pl': 'błąd', 'nl': 'fout', 'it': 'errore', 'es': 'error', 'fr': 'Erreur', 'de': 'error', 'ru': 'ошибка'};
31
32
  Blockly.Words['telegram_help'] = {'en': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md', 'pt': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md', 'pl': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md', 'nl': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md', 'it': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md', 'es': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md', 'fr': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md', 'de': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md', 'ru': 'https://github.com/ioBroker/ioBroker.telegram/blob/master/README.md'};
32
33
  Blockly.Words['telegram_silent'] = {'en': 'without notification', 'de': 'ohne Benachrichtigung', 'ru': 'без уведомления', 'pt': 'sem notificação', 'nl': 'zonder kennisgeving', 'fr': 'sans notification', 'it': 'senza notifica', 'es': 'sin notificación', 'pl': 'bez powiadomienia'};
33
34
 
@@ -42,6 +43,8 @@ Blockly.Sendto.blocks['telegram'] =
42
43
  + ' </value>'
43
44
  + ' <value name="USERNAME">'
44
45
  + ' </value>'
46
+ + ' <value name="CHATID">'
47
+ + ' </value>'
45
48
  + ' <value name="LOG">'
46
49
  + ' </value>'
47
50
  + ' <value name="SILENT">'
@@ -83,6 +86,10 @@ Blockly.Blocks['telegram'] = {
83
86
  .setCheck('String')
84
87
  .appendField(Blockly.Translate('telegram_username'));
85
88
 
89
+ var input = this.appendValueInput('CHATID')
90
+ .setCheck('String')
91
+ .appendField(Blockly.Translate('telegram_chatid'));
92
+
86
93
  this.appendDummyInput('LOG')
87
94
  .appendField(Blockly.Translate('telegram_log'))
88
95
  .appendField(new Blockly.FieldDropdown([
@@ -118,6 +125,7 @@ Blockly.JavaScript['telegram'] = function(block) {
118
125
  var logLevel = block.getFieldValue('LOG');
119
126
  var value_message = Blockly.JavaScript.valueToCode(block, 'MESSAGE', Blockly.JavaScript.ORDER_ATOMIC);
120
127
  var value_username = Blockly.JavaScript.valueToCode(block, 'USERNAME', Blockly.JavaScript.ORDER_ATOMIC);
128
+ var value_chatid = Blockly.JavaScript.valueToCode(block, 'CHATID', Blockly.JavaScript.ORDER_ATOMIC);
121
129
  var silent = block.getFieldValue('SILENT');
122
130
  var parsemode = block.getFieldValue('PARSEMODE');
123
131
 
@@ -129,7 +137,8 @@ Blockly.JavaScript['telegram'] = function(block) {
129
137
  }
130
138
 
131
139
  return 'sendTo("telegram' + dropdown_instance + '", "send", {\n text: ' +
132
- value_message + (value_username ? ', \n ' + (value_username.startsWith('-',1) ? 'chatId: ' : 'user: ') + value_username : '') +
140
+ value_message + (value_username ? ', \n user: ' + value_username : '') +
141
+ (value_chatid ? ', \n chatId: ' + value_chatid : '') +
133
142
  (silent === 'TRUE' ? ', \n disable_notification: true' : '') +
134
143
  (parsemode !== 'default' ? ', \n parse_mode: "' + parsemode + '"': '') +
135
144
  '\n});\n' +
@@ -339,6 +348,7 @@ Blockly.JavaScript['telegram_call'] = function(block) {
339
348
  var logLevel = block.getFieldValue('LOG');
340
349
  var value_message = Blockly.JavaScript.valueToCode(block, 'MESSAGE', Blockly.JavaScript.ORDER_ATOMIC);
341
350
  var value_username = Blockly.JavaScript.valueToCode(block, 'USERNAME', Blockly.JavaScript.ORDER_ATOMIC);
351
+ var value_chatid = Blockly.JavaScript.valueToCode(block, 'CHATID', Blockly.JavaScript.ORDER_ATOMIC);
342
352
 
343
353
  var logText;
344
354
  if (logLevel) {
@@ -0,0 +1,79 @@
1
+ {
2
+ "Allow state control": "Erlaube das Steuern von Zuständen",
3
+ "Auth_No": "Nein, gespeicherte Benutzer behalten!",
4
+ "Auth_Yes": "Ja, alle Benutzer löschen!",
5
+ "Authenticated Users": "Authentifizierte Benutzer",
6
+ "Buttons in line": "Tasten in Reihe",
7
+ "Call text": "Dies ist eine Meldung von ioBroker. Zuhause ist etwas passiert.",
8
+ "Chained certificate": "Verkettetes Zertifikat",
9
+ "Changed_Password": "Sie haben das Passwort für Ihren Bot geändert. Möchten Sie alle gespeicherten Benutzer jetzt löschen? Jeder Benutzer muss sich dann mit dem neuen Kennwort erneut authentifizieren, bevor er erneut mit dem Bot kommunizieren kann.",
10
+ "Command to show the keyboard": "Befehl zum Anzeigen der Tastatur",
11
+ "Done": "Fertig",
12
+ "ID \"%s\" not found.": "ID \"%s\" nicht gefunden.",
13
+ "Ignore warning": "Warnung ignorieren",
14
+ "Invalid number %s": "Ungültige Nummer %s",
15
+ "Invalid password": "Ungültiges Passwort!",
16
+ "Keyboard command": "Tastaturbefehl",
17
+ "Leave it blank if no password desired": "Leer lassen, sofern kein Kennwort gewünscht wird",
18
+ "Let's Encrypt settings": "Let's Encrypt Einstellungen",
19
+ "Listen on all IPs": "Anfragen für alle IPs beantworten",
20
+ "Login": "Proxy Benutzername",
21
+ "Main settings": "Allgemeine Einstellungen",
22
+ "Message ignored: ": "Meldung wurde ignoriert: ",
23
+ "Messages": "Nachrichten",
24
+ "No_Password": "Sie haben kein Passwort gewählt. Wenn Sie für Ihren Bot kein Passwort festlegen, kann jeder Fremde mit Ihrem Bot kommunizieren! Es wird dringend empfohlen, ein Passwort festzulegen!",
25
+ "OFF-Command": "aus",
26
+ "OFF-Status": "ausgeschaltet",
27
+ "ON-Command": "an",
28
+ "ON-Status": "eingeschaltet",
29
+ "Please enter password in form \"/password phrase\"": "Das Password muss in der Form \"/password phrase\" eingegeben werden",
30
+ "Polling interval (ms)": "Abrufintervall (ms)",
31
+ "Port": "Port",
32
+ "Port to check the domain:": "Port um die Erreichbarkeit der Domain zu prüfen",
33
+ "Private certificate": "Privates Zertifikat",
34
+ "Proxy Socks5 enable": "Proxy Socks5 aktivieren",
35
+ "Public certificate": "Öffentliches Zertifikat",
36
+ "Read README.md how to get token": "Der Anleitung in README.md folgen um den Token zu holen",
37
+ "Reauthenticate Users?": "Benutzer erneut authentifizieren?",
38
+ "Remember authenticated users": "Speichere Nutzer-IDs zur Vermeidung einer erneuten Kennwortabfrage",
39
+ "Remember raw request data": "Speichere Original-Requests zur weiteren Verarbeitung (Achtung: kann sicherheitskritische Daten enthalten!)",
40
+ "Repeat password": "Kennwort wiederholen",
41
+ "Restarting...": "Bot wird neu gestartet.",
42
+ "Restarting... Reauthenticate!": "Neustart ... Erneut authentifizieren!",
43
+ "Select option": "Wähle eine Option",
44
+ "Server settings": "Servereinstellungen",
45
+ "Set Password": "Passwort festlegen",
46
+ "Set certificates or load it first in the system settings (right top).": "Zertifikate wählen bzw. Zertifikate in den Systemeinstellungen (oben rechts) hinterlegen.",
47
+ "Show the list of rooms before the device selection": "Zeige die Liste der Räume vor der Geräte Auswahl an",
48
+ "Started!": "Bot gestartet.",
49
+ "Store username instead of firstname of remembered users": "Benutzername anstatt Vorname von Benutzern speichern",
50
+ "Text2Command info": "Alle Anfragen werden an diese text2Command-Instanz weitergeleitet",
51
+ "Texts": "Texte",
52
+ "URL may not be empty": "URL darf nicht leer sein!",
53
+ "Use Lets Encrypt certificates:": "Let's Encrypt Zertifikate verwenden",
54
+ "Use rooms in keyboard command": "Räume im Tastaturbefehl verwenden",
55
+ "Use this instance for automatic update:": "Diese Instanz für automatische Zertifikat-Updates benutzen",
56
+ "Warning!": "Warnung!",
57
+ "Welcome ": "Hallo ",
58
+ "ip": "IP",
59
+ "password": "Passwort",
60
+ "password repeat": "Kennwortwiederholung",
61
+ "polling": "Polling",
62
+ "pollingInterval": "Abfrageintervall",
63
+ "port_help": "Aktuell unterstützt: 443, 80, 88, 8443",
64
+ "proxy Host": "Proxy-Host",
65
+ "restarted": "Gestartet",
66
+ "restarted_help": "Dieser Text wird nach dem Start der Adapter-Instanz an die Clients gesendet. Zum Deaktivieren: leer lassen.",
67
+ "restarting": "Beenden",
68
+ "restarting_help": "Dieser Text wird an die Clients gesendet, sobald die Adapterinstanz gestoppt wird. Zum Deaktivieren: leer lassen.",
69
+ "server": "Server",
70
+ "telegram adapter settings": "Adapter-Einstellungen",
71
+ "text2command instance": "text2Command-Instanz",
72
+ "token": "Token",
73
+ "type": "Typ",
74
+ "url": "URL",
75
+ "url_help": "wie \"https://mydomain.noip.com:8443\"",
76
+ "value as boolean": "Wert als Boolean",
77
+ "value as number": "Wert als Zahl",
78
+ "value as string": "Wert als String"
79
+ }