我想将api响应显示为卡,但是响应重复-我在做什么错,这是对英雄卡的有效使用吗?
bot.dialog('/receipt', [
function(session){
bot.on('trigger', function (message) {
var queuedMessage = message.value;
var msg = new builder.Message()
.address(queuedMessage.address)
.attachments([
new builder.HeroCard(session)
.title("Good news - I can book this for you:")
.subtitle("Customer: " + queuedMessage.name)
.images([
builder.CardImage.create(session, "")
])
.buttons([
builder.CardAction.dialogAction(session, "bookIt", "", "Book it?"),
builder.CardAction.dialogAction(session, "help", "", "Start again?")
])
]);
session.send(msg);
})
},
]);
最佳答案
如OmG在评论中所建议:删除bot.on('trigger'
看来您正在尝试设置Azure Function
来触发漫游器发送消息:https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview为了主动从漫游器向用户发送消息,这不一定是必需的。
有关主动发送消息的文档,请参阅https://docs.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-proactive-messages。以下是node
中的一些示例:https://github.com/MicrosoftDX/botFramework-proactiveMessages/tree/master/node
关于node.js - 主动型机器人中重复的herocard响应,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43946750/