Open dangear opened 6 years ago
I have same question, you fix it?
Yes. But use other way:
I use callback_data
field when build buttons array with some parameter (id, short_string and other) and then check callbacks with callbackQueries
.
Something like this:
var kb=[]
for(var i=0;i<5;i++){
kb.push([{text:i, callback_data:i}]) //generate buttons array with callback_data field
}
$.sendMessage('Some message', {
reply_markup: JSON.stringify({
inline_keyboard: kb //input buttons
})
});
and then
tg.callbackQueries(($) => { //wait callbacks
console.log($.data) //then find what you need
})
It's work for me.
Nice, Thanks a lot. In my code instead of the "i" I'm using the controller's and command /yes that is in the tutorial. You have some idea how does this work? I want to go from the keyboard button to another command/controller with different code.
I think you can use _callback_data_ with /command and args (if need it).
Something like this:
{text:'Button text', callback_data:'/command, args'};
And then parse it in callbackQueries method.
I'm not shure that is correct way. But I think it's can work.
Have generate inlineMenu from some json-array. Code:
Buttons name from JSON-array put correctly. But in console.log show me "undefined". How I can send data from JSON-array in runInlineMenu callback?