Skip to content

Commit

Permalink
fixed #339
Browse files Browse the repository at this point in the history
  • Loading branch information
windka committed Oct 7, 2023
1 parent dc85c7f commit a4ab142
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All notable changes to this project will be documented in this file.

# [15.1.7] - 2023-08-29
### answerCallbackQuery text is now optional - [#339](https://github.com/windkh/node-red-contrib-telegrambot/issues/339)

# [15.1.6] - 2023-08-29
### stopPoll added - [#331](https://github.com/windkh/node-red-contrib-telegrambot/issues/331)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-telegrambot",
"version": "15.1.6",
"version": "15.1.7",
"description": "Telegram bot nodes for Node-RED",
"dependencies": {
"bluebird": "^3.7.2",
Expand Down
34 changes: 16 additions & 18 deletions telegrambot/99-telegrambot.js
Original file line number Diff line number Diff line change
Expand Up @@ -2486,27 +2486,25 @@ module.exports = function (RED) {

case 'callback_query':
case 'answerCallbackQuery':
if (this.hasContent(msg)) {
let callbackQueryId = msg.payload.callbackQueryId;

let options = msg.payload.options;
if (options === undefined) {
options = {};
}
let callbackQueryId = msg.payload.callbackQueryId;

Check failure on line 2489 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (12.x)

Unexpected lexical declaration in case block

Check failure on line 2489 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected lexical declaration in case block

Check failure on line 2489 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (15.x)

Unexpected lexical declaration in case block

Check failure on line 2489 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected lexical declaration in case block

Check failure on line 2489 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected lexical declaration in case block

if (options.text === undefined) {
options.text = msg.payload.content;
}
let options = msg.payload.options;

Check failure on line 2491 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (12.x)

Unexpected lexical declaration in case block

Check failure on line 2491 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected lexical declaration in case block

Check failure on line 2491 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (15.x)

Unexpected lexical declaration in case block

Check failure on line 2491 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected lexical declaration in case block

Check failure on line 2491 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected lexical declaration in case block
if (options === undefined) {
options = {};
}

telegramBot
.answerCallbackQuery(callbackQueryId, options)
.catch(function (ex) {
node.processError(ex, msg, nodeSend, nodeDone);
})
.then(function (result) {
node.processResult(result, msg, nodeSend, nodeDone);
});
if (options.text === undefined && msg.payload.content !== undefined) {
options.text = msg.payload.content;
}

telegramBot
.answerCallbackQuery(callbackQueryId, options)
.catch(function (ex) {
node.processError(ex, msg, nodeSend, nodeDone);
})
.then(function (result) {
node.processResult(result, msg, nodeSend, nodeDone);
});
break;

case 'inline_query':
Expand Down

0 comments on commit a4ab142

Please sign in to comment.