问题
I don't want to use any library and i want to create the function that can react to a pressed botton of an inline_keyboard. I use webhook.
The following code works great for incoming messages but I need help to add the callback_query data.
function doPost(e) {
var data = JSON.parse(e.postData.contents);
if(data.message){//working great
var text = data.message.text;
var id = data.message.from.id;
sendText(id,text);
}
if(data.callback_data){//this part doesn't work and i need help for this.
//no help needed here :)
}
}
回答1:
Try this one.
var data1 = JSON.parse(e.postData.contents).callback_query.<object>
Types of object
来源:https://stackoverflow.com/questions/47902879/google-app-script-telegram-bot-callback-data-of-an-inline-keyboard