iobroker.telegram 6.3.0 → 6.4.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 +3 -4
- package/admin/i18n/de.json +4 -0
- package/admin/i18n/en.json +4 -0
- package/admin/i18n/es.json +4 -0
- package/admin/i18n/fr.json +4 -0
- package/admin/i18n/it.json +4 -0
- package/admin/i18n/nl.json +4 -0
- package/admin/i18n/pl.json +4 -0
- package/admin/i18n/pt.json +4 -0
- package/admin/i18n/ru.json +4 -0
- package/admin/i18n/uk.json +4 -0
- package/admin/i18n/zh-cn.json +4 -0
- package/admin/jsonConfig.json +23 -0
- package/admin/rules/@mf-types.zip +0 -0
- package/build/main.js +95 -14
- package/build/main.js.map +1 -1
- package/build/types.d.ts +4 -0
- package/i18n/de.json +2 -1
- package/i18n/en.json +2 -1
- package/i18n/es.json +2 -1
- package/i18n/fr.json +2 -1
- package/i18n/it.json +2 -1
- package/i18n/nl.json +2 -1
- package/i18n/pl.json +2 -1
- package/i18n/pt.json +2 -1
- package/i18n/ru.json +2 -1
- package/i18n/uk.json +2 -1
- package/i18n/zh-cn.json +2 -1
- package/io-package.json +40 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,6 +40,9 @@ Use telegram service to communicate with ioBroker
|
|
|
40
40
|
Placeholder for the next version (at the beginning of the line):
|
|
41
41
|
### **WORK IN PROGRESS**
|
|
42
42
|
-->
|
|
43
|
+
### 6.4.0 (2026-11-09)
|
|
44
|
+
- (@GermanBluefox) Voice messages can be converted to text by an `ai-parakeet` instance (new setting "Speech recognition instance"); the text is then processed like a typed message (`communicate.request`, commands, `text2command`, assistant) and also written to the new state `communicate.requestVoiceText`. "Show the recognised text in the chat" answers with what was understood (🎤 …)
|
|
45
|
+
|
|
43
46
|
### 6.3.0 (2026-11-07)
|
|
44
47
|
- (@GermanBluefox) Added "Delete received files after (days)": saved voice messages, photos, videos, audio files and documents older than that are deleted, in the file system or in the file storage, checked every hour. 0 (default) keeps them as before
|
|
45
48
|
|
|
@@ -57,10 +60,6 @@ Use telegram service to communicate with ioBroker
|
|
|
57
60
|
- (@GermanBluefox) The Blockly block "telegram" has an optional input for the topic (thread id) of a forum group (#952)
|
|
58
61
|
- (@GermanBluefox) Completed the Blockly translations for Ukrainian and Chinese
|
|
59
62
|
|
|
60
|
-
### 6.0.2 (2026-09-12)
|
|
61
|
-
- (@GermanBluefox) Updated packages and improved the rules block
|
|
62
|
-
- (@patricknitsch) Retried getUpdates 409 conflicts quickly before falling back to a slow restartart
|
|
63
|
-
|
|
64
63
|
[Older changelogs can be found there](CHANGELOG_OLD.md)
|
|
65
64
|
|
|
66
65
|
## License
|
package/admin/i18n/de.json
CHANGED
|
@@ -72,6 +72,8 @@
|
|
|
72
72
|
"Set Password": "Passwort festlegen",
|
|
73
73
|
"Set certificates or load it first in the system settings (right top).": "Zertifikate wählen bzw. Zertifikate in den Systemeinstellungen (oben rechts) hinterlegen.",
|
|
74
74
|
"Show the list of rooms before the device selection": "Zeige die Liste der Räume vor der Geräte Auswahl an",
|
|
75
|
+
"Show the recognised text in the chat": "Erkannten Text im Chat anzeigen",
|
|
76
|
+
"Speech recognition instance": "Spracherkennungs-Instanz",
|
|
75
77
|
"Started!": "Bot gestartet.",
|
|
76
78
|
"Store username instead of firstname of remembered users": "Benutzername anstatt Vorname von Benutzern speichern",
|
|
77
79
|
"Text2Command info": "Alle Anfragen werden an diese text2Command-Instanz weitergeleitet",
|
|
@@ -103,6 +105,8 @@
|
|
|
103
105
|
"restarting": "Beenden",
|
|
104
106
|
"restarting_help": "Dieser Text wird an die Clients gesendet, sobald die Adapterinstanz gestoppt wird. Zum Deaktivieren: leer lassen.",
|
|
105
107
|
"server": "Server",
|
|
108
|
+
"speechToTextEcho_help": "Der Bot antwortet auf eine Sprachnachricht zuerst mit dem, was er verstanden hat (🎤 …)",
|
|
109
|
+
"speechToText_help": "Sprachnachrichten werden von dieser ioBroker.ai-parakeet-Instanz erkannt und wie eine Textnachricht verarbeitet (Befehle, text2command, Assistent). Leer: aus",
|
|
106
110
|
"telegram adapter settings": "Adapter-Einstellungen",
|
|
107
111
|
"text2command instance": "text2Command-Instanz",
|
|
108
112
|
"token": "Token",
|
package/admin/i18n/en.json
CHANGED
|
@@ -72,6 +72,8 @@
|
|
|
72
72
|
"Set Password": "Set Password",
|
|
73
73
|
"Set certificates or load it first in the system settings (right top).": "Set certificates or define it first in the system settings (right top).",
|
|
74
74
|
"Show the list of rooms before the device selection": "Show the list of rooms before the device selection",
|
|
75
|
+
"Show the recognised text in the chat": "Show the recognised text in the chat",
|
|
76
|
+
"Speech recognition instance": "Speech recognition instance",
|
|
75
77
|
"Started!": "Started!",
|
|
76
78
|
"Store username instead of firstname of remembered users": "Store username instead of first name of remembered users",
|
|
77
79
|
"Text2Command info": "All requests will be sent to this text2Command instance",
|
|
@@ -103,6 +105,8 @@
|
|
|
103
105
|
"restarting": "Stopping",
|
|
104
106
|
"restarting_help": "This text will be sent to clients once the adapter instance is going to be stopped. Leave blank to deactivate.",
|
|
105
107
|
"server": "server",
|
|
108
|
+
"speechToTextEcho_help": "The bot answers a voice message first with what it understood (🎤 …)",
|
|
109
|
+
"speechToText_help": "Voice messages are recognised by this ioBroker.ai-parakeet instance and processed like a text message (commands, text2command, assistant). Empty: off",
|
|
106
110
|
"telegram adapter settings": "telegram adapter settings",
|
|
107
111
|
"text2command instance": "Text2Command instance",
|
|
108
112
|
"token": "Token",
|
package/admin/i18n/es.json
CHANGED
|
@@ -72,6 +72,8 @@
|
|
|
72
72
|
"Set Password": "Configurar la clave",
|
|
73
73
|
"Set certificates or load it first in the system settings (right top).": "Establezca certificados o cárguelos primero en la configuración del sistema (arriba a la derecha).",
|
|
74
74
|
"Show the list of rooms before the device selection": "Mostrar la lista de habitaciones antes de la selección del dispositivo.",
|
|
75
|
+
"Show the recognised text in the chat": "Mostrar el texto reconocido en el chat",
|
|
76
|
+
"Speech recognition instance": "Instancia de reconocimiento de voz",
|
|
75
77
|
"Started!": "¡Empezado!",
|
|
76
78
|
"Store username instead of firstname of remembered users": "Guardar nombre de usuario en lugar del nombre de los usuarios recordados",
|
|
77
79
|
"Text2Command info": "Todas las solicitudes se enviarán a esta instancia de text2Command",
|
|
@@ -103,6 +105,8 @@
|
|
|
103
105
|
"restarting": "Deteniendo",
|
|
104
106
|
"restarting_help": "Este texto se enviará a los clientes una vez que se detenga la instancia del adaptador. Dejar en blanco para desactivar.",
|
|
105
107
|
"server": "servidor",
|
|
108
|
+
"speechToTextEcho_help": "El bot responde primero a un mensaje de voz con lo que ha entendido (🎤 …)",
|
|
109
|
+
"speechToText_help": "Los mensajes de voz se reconocen con esta instancia de ioBroker.ai-parakeet y se procesan como un mensaje de texto (comandos, text2command, asistente). Vacío: desactivado",
|
|
106
110
|
"telegram adapter settings": "Configuración del adaptador de Telegram",
|
|
107
111
|
"text2command instance": "Instancia Text2Command",
|
|
108
112
|
"token": "Token",
|
package/admin/i18n/fr.json
CHANGED
|
@@ -72,6 +72,8 @@
|
|
|
72
72
|
"Set Password": "Définir le mot de passe",
|
|
73
73
|
"Set certificates or load it first in the system settings (right top).": "Définissez des certificats ou chargez-les d'abord dans les paramètres du système (en haut à droite).",
|
|
74
74
|
"Show the list of rooms before the device selection": "Afficher la liste des pièces avant la sélection de l'appareil",
|
|
75
|
+
"Show the recognised text in the chat": "Afficher le texte reconnu dans le chat",
|
|
76
|
+
"Speech recognition instance": "Instance de reconnaissance vocale",
|
|
75
77
|
"Started!": "Commencé!",
|
|
76
78
|
"Store username instead of firstname of remembered users": "Store username instead of firstname of remembered users",
|
|
77
79
|
"Text2Command info": "Toutes les demandes seront envoyées à cette instance de text2Command",
|
|
@@ -103,6 +105,8 @@
|
|
|
103
105
|
"restarting": "Redémarrage",
|
|
104
106
|
"restarting_help": "Ce texte sera envoyé aux clients une fois que l'instance d'adaptateur va être arrêtée. Laissez vide pour désactiver.",
|
|
105
107
|
"server": "serveur",
|
|
108
|
+
"speechToTextEcho_help": "Le bot répond d'abord à un message vocal avec ce qu'il a compris (🎤 …)",
|
|
109
|
+
"speechToText_help": "Les messages vocaux sont reconnus par cette instance ioBroker.ai-parakeet et traités comme un message texte (commandes, text2command, assistant). Vide : désactivé",
|
|
106
110
|
"telegram adapter settings": "paramètres de l'adaptateur de télégramme",
|
|
107
111
|
"text2command instance": "Instance Text2Command",
|
|
108
112
|
"token": "Token",
|
package/admin/i18n/it.json
CHANGED
|
@@ -72,6 +72,8 @@
|
|
|
72
72
|
"Set Password": "Impostare la password",
|
|
73
73
|
"Set certificates or load it first in the system settings (right top).": "Imposta i certificati o caricali prima nelle impostazioni di sistema (in alto a destra).",
|
|
74
74
|
"Show the list of rooms before the device selection": "Mostra l'elenco delle sale prima della selezione del dispositivo",
|
|
75
|
+
"Show the recognised text in the chat": "Mostra il testo riconosciuto nella chat",
|
|
76
|
+
"Speech recognition instance": "Istanza di riconoscimento vocale",
|
|
75
77
|
"Started!": "Iniziato!",
|
|
76
78
|
"Store username instead of firstname of remembered users": "Store username instead of firstname of remembered users",
|
|
77
79
|
"Text2Command info": "Tutte le richieste verranno inviate a questa istanza text2Command",
|
|
@@ -103,6 +105,8 @@
|
|
|
103
105
|
"restarting": "Riavvio",
|
|
104
106
|
"restarting_help": "Questo testo verrà inviato ai client una volta che l'istanza dell'adattatore verrà arrestata. Lascia vuoto per disattivare.",
|
|
105
107
|
"server": "server",
|
|
108
|
+
"speechToTextEcho_help": "Il bot risponde prima a un messaggio vocale con ciò che ha capito (🎤 …)",
|
|
109
|
+
"speechToText_help": "I messaggi vocali vengono riconosciuti da questa istanza di ioBroker.ai-parakeet ed elaborati come un messaggio di testo (comandi, text2command, assistente). Vuoto: disattivato",
|
|
106
110
|
"telegram adapter settings": "impostazioni dell'adattatore telegramma",
|
|
107
111
|
"text2command instance": "Istanza Text2Command",
|
|
108
112
|
"token": "Token",
|
package/admin/i18n/nl.json
CHANGED
|
@@ -72,6 +72,8 @@
|
|
|
72
72
|
"Set Password": "Stel een wachtwoord in",
|
|
73
73
|
"Set certificates or load it first in the system settings (right top).": "Stel certificaten in of laad het eerst in de systeeminstellingen (rechtsboven).",
|
|
74
74
|
"Show the list of rooms before the device selection": "Toon de lijst met kamers vóór de apparaatselectie",
|
|
75
|
+
"Show the recognised text in the chat": "Herkende tekst in de chat tonen",
|
|
76
|
+
"Speech recognition instance": "Instantie voor spraakherkenning",
|
|
75
77
|
"Started!": "Begonnen!",
|
|
76
78
|
"Store username instead of firstname of remembered users": "Store username instead of firstname of remembered users",
|
|
77
79
|
"Text2Command info": "Alle aanvragen worden verzonden naar dit text2Command-exemplaar",
|
|
@@ -103,6 +105,8 @@
|
|
|
103
105
|
"restarting": "Het opnieuw starten",
|
|
104
106
|
"restarting_help": "Deze tekst wordt naar klanten verzonden zodra de adapterinstantie wordt gestopt. Laat leeg om te deactiveren.",
|
|
105
107
|
"server": "server",
|
|
108
|
+
"speechToTextEcho_help": "De bot antwoordt op een spraakbericht eerst met wat hij heeft verstaan (🎤 …)",
|
|
109
|
+
"speechToText_help": "Spraakberichten worden door deze ioBroker.ai-parakeet-instantie herkend en verwerkt als een tekstbericht (commando’s, text2command, assistent). Leeg: uit",
|
|
106
110
|
"telegram adapter settings": "telegram-adapterinstellingen",
|
|
107
111
|
"text2command instance": "Text2Command Instance",
|
|
108
112
|
"token": "Token",
|
package/admin/i18n/pl.json
CHANGED
|
@@ -72,6 +72,8 @@
|
|
|
72
72
|
"Set Password": "Ustaw hasło",
|
|
73
73
|
"Set certificates or load it first in the system settings (right top).": "Ustaw certyfikaty lub załaduj najpierw w ustawieniach systemu (prawy górny).",
|
|
74
74
|
"Show the list of rooms before the device selection": "Pokaż listę pokojów przed wyborem urządzenia",
|
|
75
|
+
"Show the recognised text in the chat": "Pokaż rozpoznany tekst na czacie",
|
|
76
|
+
"Speech recognition instance": "Instancja rozpoznawania mowy",
|
|
75
77
|
"Started!": "Rozpoczęty!",
|
|
76
78
|
"Store username instead of firstname of remembered users": "Store username instead of firstname of remembered users",
|
|
77
79
|
"Text2Command info": "Wszystkie żądania zostaną wysłane do tej instancji text2Command",
|
|
@@ -103,6 +105,8 @@
|
|
|
103
105
|
"restarting": "Ponowne uruchamianie",
|
|
104
106
|
"restarting_help": "Ten tekst zostanie wysłany do klientów, gdy instancja adaptera zostanie zatrzymana. Pozostaw puste, aby dezaktywować.",
|
|
105
107
|
"server": "serwer",
|
|
108
|
+
"speechToTextEcho_help": "Bot najpierw odpowiada na wiadomość głosową tym, co zrozumiał (🎤 …)",
|
|
109
|
+
"speechToText_help": "Wiadomości głosowe są rozpoznawane przez tę instancję ioBroker.ai-parakeet i przetwarzane jak wiadomość tekstowa (polecenia, text2command, asystent). Puste: wyłączone",
|
|
106
110
|
"telegram adapter settings": "ustawienia adaptera telegramu",
|
|
107
111
|
"text2command instance": "Instancja Text2Command",
|
|
108
112
|
"token": "Token",
|
package/admin/i18n/pt.json
CHANGED
|
@@ -72,6 +72,8 @@
|
|
|
72
72
|
"Set Password": "Definir uma senha",
|
|
73
73
|
"Set certificates or load it first in the system settings (right top).": "Defina certificados ou carregue primeiro nas configurações do sistema (parte superior direita).",
|
|
74
74
|
"Show the list of rooms before the device selection": "Mostra a lista de quartos antes da seleção do dispositivo",
|
|
75
|
+
"Show the recognised text in the chat": "Mostrar o texto reconhecido no chat",
|
|
76
|
+
"Speech recognition instance": "Instância de reconhecimento de fala",
|
|
75
77
|
"Started!": "O bot foi iniciado!",
|
|
76
78
|
"Store username instead of firstname of remembered users": "Salvar o nome do usuário em vez do primeiro nome dos usuários",
|
|
77
79
|
"Text2Command info": "Todas as solicitações são encaminhadas para esta instância do Text2Command",
|
|
@@ -103,6 +105,8 @@
|
|
|
103
105
|
"restarting": "Terminar",
|
|
104
106
|
"restarting_help": "Esse texto é enviado aos clientes assim que a instância do adaptador é interrompida. Para desativar deixe em branco.",
|
|
105
107
|
"server": "servidor",
|
|
108
|
+
"speechToTextEcho_help": "O bot responde primeiro a uma mensagem de voz com o que entendeu (🎤 …)",
|
|
109
|
+
"speechToText_help": "As mensagens de voz são reconhecidas por esta instância do ioBroker.ai-parakeet e processadas como uma mensagem de texto (comandos, text2command, assistente). Vazio: desligado",
|
|
106
110
|
"telegram adapter settings": "Configurações do adaptador de Telegrama",
|
|
107
111
|
"text2command instance": "Instância de Text2Command",
|
|
108
112
|
"token": "Token",
|
package/admin/i18n/ru.json
CHANGED
|
@@ -72,6 +72,8 @@
|
|
|
72
72
|
"Set Password": "Установка пароля",
|
|
73
73
|
"Set certificates or load it first in the system settings (right top).": "Нужно выбрать сертификаты или сначала загрузить их в системных настройках (вверху справа).",
|
|
74
74
|
"Show the list of rooms before the device selection": "Показывать список комнат до выбора устройства",
|
|
75
|
+
"Show the recognised text in the chat": "Показывать распознанный текст в чате",
|
|
76
|
+
"Speech recognition instance": "Экземпляр распознавания речи",
|
|
75
77
|
"Started!": "Бот запущен!",
|
|
76
78
|
"Store username instead of firstname of remembered users": "Сохранять логины вместо имен для сохраненных пользователей",
|
|
77
79
|
"Text2Command info": "Все сообщения от клиентов будут пересылаться на этот экземпляр драйвера text2Command",
|
|
@@ -103,6 +105,8 @@
|
|
|
103
105
|
"restarting": "Остановка",
|
|
104
106
|
"restarting_help": "Этот текст будет отправлен клиентам после остановки экземпляра адаптера. Оставьте пустым, чтобы ничего не отсылать.",
|
|
105
107
|
"server": "сервер",
|
|
108
|
+
"speechToTextEcho_help": "Бот сначала отвечает на голосовое сообщение тем, что он понял (🎤 …)",
|
|
109
|
+
"speechToText_help": "Голосовые сообщения распознаются этим экземпляром ioBroker.ai-parakeet и обрабатываются как текстовое сообщение (команды, text2command, ассистент). Пусто: выключено",
|
|
106
110
|
"telegram adapter settings": "Настройки адаптера telegram",
|
|
107
111
|
"text2command instance": "Экземпляр Text2Command",
|
|
108
112
|
"token": "Токен",
|
package/admin/i18n/uk.json
CHANGED
|
@@ -72,6 +72,8 @@
|
|
|
72
72
|
"Set Password": "Встановити пароль",
|
|
73
73
|
"Set certificates or load it first in the system settings (right top).": "Встановіть сертифікати або спочатку визначте їх у налаштуваннях системи (справа вгорі).",
|
|
74
74
|
"Show the list of rooms before the device selection": "Показати список кімнат перед вибором пристрою",
|
|
75
|
+
"Show the recognised text in the chat": "Показувати розпізнаний текст у чаті",
|
|
76
|
+
"Speech recognition instance": "Екземпляр розпізнавання мовлення",
|
|
75
77
|
"Started!": "Почати!",
|
|
76
78
|
"Store username instead of firstname of remembered users": "Зберігайте ім’я користувача замість імен запам’ятованих користувачів",
|
|
77
79
|
"Text2Command info": "Усі запити надсилатимуться до цього екземпляра text2Command",
|
|
@@ -103,6 +105,8 @@
|
|
|
103
105
|
"restarting": "Зупинка",
|
|
104
106
|
"restarting_help": "Цей текст буде надіслано клієнтам, коли екземпляр адаптера буде зупинено. Залиште порожнім, щоб деактивувати.",
|
|
105
107
|
"server": "сервер",
|
|
108
|
+
"speechToTextEcho_help": "Бот спочатку відповідає на голосове повідомлення тим, що він зрозумів (🎤 …)",
|
|
109
|
+
"speechToText_help": "Голосові повідомлення розпізнаються цим екземпляром ioBroker.ai-parakeet і обробляються як текстове повідомлення (команди, text2command, асистент). Порожньо: вимкнено",
|
|
106
110
|
"telegram adapter settings": "налаштування адаптера telegram",
|
|
107
111
|
"text2command instance": "Екземпляр Text2Command",
|
|
108
112
|
"token": "Токен",
|
package/admin/i18n/zh-cn.json
CHANGED
|
@@ -72,6 +72,8 @@
|
|
|
72
72
|
"Set Password": "设置密码",
|
|
73
73
|
"Set certificates or load it first in the system settings (right top).": "设置证书或首先在系统设置中加载它(右上角)。",
|
|
74
74
|
"Show the list of rooms before the device selection": "在设备选择之前显示房间列表",
|
|
75
|
+
"Show the recognised text in the chat": "在聊天中显示识别出的文本",
|
|
76
|
+
"Speech recognition instance": "语音识别实例",
|
|
75
77
|
"Started!": "开始!",
|
|
76
78
|
"Store username instead of firstname of remembered users": "存储用户名而不是记住用户的名字",
|
|
77
79
|
"Text2Command info": "所有请求都将发送到此text2Command实例",
|
|
@@ -103,6 +105,8 @@
|
|
|
103
105
|
"restarting": "停止",
|
|
104
106
|
"restarting_help": "一旦适配器实例即将停止,此文本将发送给客户端。留空以停用。",
|
|
105
107
|
"server": "服务器",
|
|
108
|
+
"speechToTextEcho_help": "机器人先用它听懂的内容回复语音消息(🎤 …)",
|
|
109
|
+
"speechToText_help": "语音消息由此 ioBroker.ai-parakeet 实例识别,并像文本消息一样处理(命令、text2command、助手)。留空:关闭",
|
|
106
110
|
"telegram adapter settings": "电报适配器设置",
|
|
107
111
|
"text2command instance": "Text2Command实例",
|
|
108
112
|
"token": "代币",
|
package/admin/jsonConfig.json
CHANGED
|
@@ -354,6 +354,29 @@
|
|
|
354
354
|
"help": "Photos go to the assistant with their caption as the question. Videos are stored in the file storage of this instance (folder assistant) and only their place goes along.",
|
|
355
355
|
"hidden": "!data.assistantInstance"
|
|
356
356
|
},
|
|
357
|
+
"speechToText": {
|
|
358
|
+
"newLine": true,
|
|
359
|
+
"type": "instance",
|
|
360
|
+
"adapter": "ai-parakeet",
|
|
361
|
+
"xs": 12,
|
|
362
|
+
"sm": 12,
|
|
363
|
+
"md": 4,
|
|
364
|
+
"lg": 4,
|
|
365
|
+
"xl": 4,
|
|
366
|
+
"label": "Speech recognition instance",
|
|
367
|
+
"help": "speechToText_help"
|
|
368
|
+
},
|
|
369
|
+
"speechToTextEcho": {
|
|
370
|
+
"type": "checkbox",
|
|
371
|
+
"xs": 12,
|
|
372
|
+
"sm": 12,
|
|
373
|
+
"md": 8,
|
|
374
|
+
"lg": 8,
|
|
375
|
+
"xl": 8,
|
|
376
|
+
"label": "Show the recognised text in the chat",
|
|
377
|
+
"help": "speechToTextEcho_help",
|
|
378
|
+
"hidden": "!data.speechToText"
|
|
379
|
+
},
|
|
357
380
|
"answerTimeoutSec": {
|
|
358
381
|
"newLine": true,
|
|
359
382
|
"type": "number",
|
|
Binary file
|
package/build/main.js
CHANGED
|
@@ -47,6 +47,8 @@ const actions = [
|
|
|
47
47
|
* a limit a request lost on the way (e.g. the assistant restarted meanwhile) would leave the user without any reply.
|
|
48
48
|
*/
|
|
49
49
|
const ASSISTANT_TIMEOUT_MS = 120_000;
|
|
50
|
+
/** How long the speech recognition (ioBroker.ai-parakeet) may take, including loading the model after idle. */
|
|
51
|
+
const SPEECH_TO_TEXT_TIMEOUT_MS = 90_000;
|
|
50
52
|
/** Rejected by `sendToIfAlive` when the instance did not answer in time. */
|
|
51
53
|
class SendToTimeoutError extends Error {
|
|
52
54
|
}
|
|
@@ -362,7 +364,7 @@ class Telegram extends adapter_core_1.Adapter {
|
|
|
362
364
|
*/
|
|
363
365
|
async migrateInstanceIds() {
|
|
364
366
|
const migrated = {};
|
|
365
|
-
for (const key of ['text2command', 'assistantInstance']) {
|
|
367
|
+
for (const key of ['text2command', 'assistantInstance', 'speechToText']) {
|
|
366
368
|
const value = this.config[key];
|
|
367
369
|
if (typeof value === 'string' && value.startsWith('system.adapter.')) {
|
|
368
370
|
const shortId = value.substring('system.adapter.'.length);
|
|
@@ -1719,33 +1721,108 @@ class Telegram extends adapter_core_1.Adapter {
|
|
|
1719
1721
|
}).catch(err => this.log.error(`send Message Error: ${err}`));
|
|
1720
1722
|
}
|
|
1721
1723
|
/**
|
|
1722
|
-
*
|
|
1723
|
-
*
|
|
1724
|
-
*
|
|
1724
|
+
* The checks of the text pipeline for a voice message, done before the recording is recognised: an old message
|
|
1725
|
+
* is dropped, and a user that is not allowed gets the same answer as for a text message. Without it anyone could
|
|
1726
|
+
* use the speech recognition (or talk to the assistant) just by sending a voice message.
|
|
1725
1727
|
*
|
|
1726
1728
|
* @param msg the voice message
|
|
1727
|
-
* @
|
|
1729
|
+
* @returns whether the voice message may be processed
|
|
1728
1730
|
*/
|
|
1729
|
-
async
|
|
1730
|
-
const bot = this.bot;
|
|
1731
|
+
async acceptVoiceMessage(msg) {
|
|
1731
1732
|
const from = msg.from;
|
|
1732
|
-
const user = !this.config.useUsername ? from.first_name : !from.username ? from.first_name : from.username;
|
|
1733
1733
|
const pollingInterval = parseInt(String(this.config.pollingInterval ?? 0), 10) || 0;
|
|
1734
1734
|
if (Date.now() - msg.date * 1000 > pollingInterval + 30000) {
|
|
1735
1735
|
this.log.warn(`Voice message from ${from.first_name} ignored, because too old`);
|
|
1736
|
-
return;
|
|
1736
|
+
return false;
|
|
1737
1737
|
}
|
|
1738
1738
|
if ((this.config.password || this.config.doNotAcceptNewUsers) && !this.storedUsers[from.id]) {
|
|
1739
|
-
await bot.api
|
|
1740
|
-
.sendMessage({
|
|
1739
|
+
await this.bot.api.sendMessage({
|
|
1741
1740
|
chat_id: from.id,
|
|
1742
1741
|
text: adapter_core_1.I18n.translate(this.config.doNotAcceptNewUsers
|
|
1743
1742
|
? 'User is not in the list'
|
|
1744
1743
|
: 'Please enter password in form "/password phrase"'),
|
|
1744
|
+
}).catch(error => this.log.error(`send Message Error: ${error}`));
|
|
1745
|
+
return false;
|
|
1746
|
+
}
|
|
1747
|
+
return true;
|
|
1748
|
+
}
|
|
1749
|
+
/** How long the speech recognition may take (a field so that tests can shorten it). */
|
|
1750
|
+
speechToTextTimeoutMs = SPEECH_TO_TEXT_TIMEOUT_MS;
|
|
1751
|
+
/**
|
|
1752
|
+
* Recognise a voice message with the speech recognition instance (ioBroker.ai-parakeet, `transcribe`) and process
|
|
1753
|
+
* the recognised text like a text message: `communicate.request`, the commands of this adapter, text2command and
|
|
1754
|
+
* the assistant all get it.
|
|
1755
|
+
*
|
|
1756
|
+
* @param msg the voice message
|
|
1757
|
+
* @param download the running download of the recording (OGG/Opus)
|
|
1758
|
+
*/
|
|
1759
|
+
async transcribeVoice(msg, download) {
|
|
1760
|
+
const bot = this.bot;
|
|
1761
|
+
const instance = this.config.speechToText;
|
|
1762
|
+
if (!(await this.acceptVoiceMessage(msg))) {
|
|
1763
|
+
return;
|
|
1764
|
+
}
|
|
1765
|
+
const content = await download;
|
|
1766
|
+
const options = msg.is_topic_message ? { message_thread_id: msg.message_thread_id } : undefined;
|
|
1767
|
+
bot.api.sendChatAction({ ...options, chat_id: msg.chat.id, action: 'typing' }).catch(() => { });
|
|
1768
|
+
// the names of the commands help the recognition to write them as configured (e.g. "ioBroker")
|
|
1769
|
+
const prompt = Object.values(this.commands)
|
|
1770
|
+
.map(command => command.alias)
|
|
1771
|
+
.filter(alias => typeof alias === 'string' && alias)
|
|
1772
|
+
.join(', ');
|
|
1773
|
+
this.log.debug(`Recognise voice message (${content.length} bytes) with ${instance}`);
|
|
1774
|
+
let response;
|
|
1775
|
+
try {
|
|
1776
|
+
response = (await this.sendToIfAlive(instance, 'transcribe', { audio: content.toString('base64'), ...(prompt ? { prompt } : {}) }, this.speechToTextTimeoutMs));
|
|
1777
|
+
}
|
|
1778
|
+
catch (error) {
|
|
1779
|
+
this.log.warn(`Cannot recognise voice message with ${instance}: ${error instanceof Error ? error.message : String(error)}`);
|
|
1780
|
+
response = { error: String(error) };
|
|
1781
|
+
}
|
|
1782
|
+
if (!response) {
|
|
1783
|
+
// the instance is not running: already logged
|
|
1784
|
+
return;
|
|
1785
|
+
}
|
|
1786
|
+
// the model writes a full stop at the end, which would break e.g. "<alias> on"
|
|
1787
|
+
const text = (response.text || '').trim().replace(/[.!]+$/, '');
|
|
1788
|
+
if (response.error || !text) {
|
|
1789
|
+
if (response.error) {
|
|
1790
|
+
this.log.warn(`${instance} cannot recognise the voice message: ${response.error}`);
|
|
1791
|
+
}
|
|
1792
|
+
await bot.api
|
|
1793
|
+
.sendMessage({
|
|
1794
|
+
...options,
|
|
1795
|
+
chat_id: msg.chat.id,
|
|
1796
|
+
text: adapter_core_1.I18n.translate('The voice message could not be recognised.'),
|
|
1745
1797
|
})
|
|
1746
1798
|
.catch(error => this.log.error(`send Message Error: ${error}`));
|
|
1747
1799
|
return;
|
|
1748
1800
|
}
|
|
1801
|
+
this.log.debug(`Recognised voice message: ${text}`);
|
|
1802
|
+
this.setStateSafe('communicate.requestVoiceText', { val: text, ack: true });
|
|
1803
|
+
if (this.config.speechToTextEcho !== false) {
|
|
1804
|
+
// show what was understood, so a wrong answer can be told apart from a misheard command
|
|
1805
|
+
await bot.api
|
|
1806
|
+
.sendMessage({ ...options, chat_id: msg.chat.id, text: `🎤 ${text}` })
|
|
1807
|
+
.catch(error => this.log.error(`send Message Error: ${error}`));
|
|
1808
|
+
}
|
|
1809
|
+
await this.processTelegramText({ ...msg, text });
|
|
1810
|
+
}
|
|
1811
|
+
/**
|
|
1812
|
+
* Forward a voice message to the ioBroker.assistant instance: it recognises the speech, answers like a text
|
|
1813
|
+
* question (same `source`, so the conversation continues) and returns what it heard. The same user check as for
|
|
1814
|
+
* text messages applies — without it anyone could talk to the assistant just by sending a voice message.
|
|
1815
|
+
*
|
|
1816
|
+
* @param msg the voice message
|
|
1817
|
+
* @param download the running download of the recording (OGG/Opus)
|
|
1818
|
+
*/
|
|
1819
|
+
async askAssistantByVoice(msg, download) {
|
|
1820
|
+
const bot = this.bot;
|
|
1821
|
+
const from = msg.from;
|
|
1822
|
+
const user = !this.config.useUsername ? from.first_name : !from.username ? from.first_name : from.username;
|
|
1823
|
+
if (!(await this.acceptVoiceMessage(msg))) {
|
|
1824
|
+
return;
|
|
1825
|
+
}
|
|
1749
1826
|
const content = await download;
|
|
1750
1827
|
const options = msg.is_topic_message ? { message_thread_id: msg.message_thread_id } : undefined;
|
|
1751
1828
|
// recognition + answer take a few seconds: show that something is happening
|
|
@@ -2187,10 +2264,14 @@ class Telegram extends adapter_core_1.Adapter {
|
|
|
2187
2264
|
this.queueAssistantMedia(msg);
|
|
2188
2265
|
}
|
|
2189
2266
|
if (msg.voice) {
|
|
2190
|
-
// Downloaded once: stored as before (communicate.pathFile) and
|
|
2191
|
-
// and
|
|
2267
|
+
// Downloaded once: stored as before (communicate.pathFile) and recognised: with a speech recognition
|
|
2268
|
+
// instance here, and the text goes on like a text message; else with an assistant instance there.
|
|
2269
|
+
// A voice message with a caption is answered by its caption (text pipeline) instead.
|
|
2192
2270
|
const download = this.downloadFile(msg.voice.file_id);
|
|
2193
|
-
if (this.config.
|
|
2271
|
+
if (this.config.speechToText && msg.from && !msg.caption) {
|
|
2272
|
+
this.transcribeVoice(msg, download).catch(err => this.log.error(`Cannot recognise voice message with ${this.config.speechToText}: ${err}`));
|
|
2273
|
+
}
|
|
2274
|
+
else if (this.config.assistantInstance && msg.from && !msg.caption) {
|
|
2194
2275
|
this.askAssistantByVoice(msg, download).catch(err => this.log.error(`Cannot send voice message to ${this.config.assistantInstance}: ${err}`));
|
|
2195
2276
|
}
|
|
2196
2277
|
download
|