Keyboard Button CallBack Query function to get callbacks on clicks
i want to get callback query from keyboard buttons. can someone suggest me to get the same using node-telegram-bot-api. i know its not integrated into it can someone give me idea where the callback query is going in api modules or anykind of help
var TelegramBot = require('node-telegram-bot-api');
TelegramBot.prototype.__processUpdate = TelegramBot.prototype._processUpdate;
TelegramBot.prototype._processUpdate = function _processUpdate(update) {
const callbackQuery = update.callback_query;
if (callbackQuery)
this.emit('callback_query', callbackQuery);
else
this.__processUpdate(update);
};
Check out this package https://www.npmjs.com/package/monkey-patches-node-telegram-bot-api
@mironov @Niklv Thankx a lot
Please avoid listening on callback_query as illustrated above. It is unnecessary as callback_query event emission is already implemented. Also, you should not rely on methods prefixed with one or more dashes (_). They are private (or internal) methods; not to be used by library consumers.
TelegramBot already emits callback_query when one is encountered. Thus,
bot.on("callback_query", function(callbackQuery) {
// 'callbackQuery' is of type CallbackQuery
console.log(callbackQuery);
});
See CallbackQuery for more information.