node-red-contrib-knx-ultimate 6.3.21 → 6.3.24

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.
@@ -4,8 +4,8 @@
4
4
  id: 'windkh-telegrambot',
5
5
  title: 'windkh/node-red-contrib-telegrambot',
6
6
  inputCode: `// Receiver/Event -> KNX AI
7
- // Supports "telegram receiver" text messages and "telegram event"
8
- // callback_query messages produced by inline confirmation buttons.
7
+ // Supports normal "telegram receiver" messages, including the one-time
8
+ // reply-keyboard confirmation buttons, plus legacy callback_query events.
9
9
  const telegram = msg.payload;
10
10
  if (!telegram || typeof telegram !== 'object') return;
11
11
 
@@ -33,8 +33,9 @@ msg.topic = 'ask';
33
33
  msg.prompt = content;
34
34
  return msg;`,
35
35
  outputCode: `// KNX AI chat output -> Telegram sender
36
- // Converts the text reply and, when required, adds inline
37
- // confirmation/cancellation buttons.
36
+ // Converts the text reply and, when required, adds a one-time reply keyboard.
37
+ // A button click returns through the normal Telegram receiver, so no separate
38
+ // callback event node is required.
38
39
  const source = msg.inputMessage && typeof msg.inputMessage === 'object'
39
40
  ? msg.inputMessage
40
41
  : inputMessage;
@@ -78,16 +79,17 @@ const confirmation = msg.knxAi && msg.knxAi.confirmationRequest;
78
79
  if (confirmation && confirmation.required === true && Array.isArray(confirmation.actions)) {
79
80
  telegramPayload.options = {
80
81
  reply_markup: JSON.stringify({
81
- inline_keyboard: [
82
- confirmation.actions.map(function (action) {
83
- return {
84
- text: action.label,
85
- callback_data: action.callbackData
86
- };
87
- })
88
- ]
82
+ keyboard: [confirmation.actions.map(function (action) {
83
+ return { text: action.label };
84
+ })],
85
+ resize_keyboard: true,
86
+ one_time_keyboard: true
89
87
  })
90
88
  };
89
+ } else if (msg.knxAi && (/^knx_confirmation_/.test(String(msg.knxAi.type || '')) || /^knx_routine_/.test(String(msg.knxAi.type || '')))) {
90
+ telegramPayload.options = {
91
+ reply_markup: JSON.stringify({ remove_keyboard: true })
92
+ };
91
93
  }
92
94
 
93
95
  msg.payload = telegramPayload;