我正在使用bot框架。我有我的Facebook机器人在线,我正在检查我的服务器中的所有请求。有时我的服务器没有收到提示答案(HeroCards按钮工作完美)。如果我多次重试并发送消息,它就可以了。如果我使用模拟器,它可以正常工作。
module.exports = (bot, builder, connector) => {
bot.dialog('/delivery', [
(session) => {
session.send('Bienvenido a 99UNO Delivery.');
let msg = new builder.Message(session)
.attachmentLayout(builder.AttachmentLayout.carousel)
.attachments([
new builder.HeroCard(session)
.title('Pizza')
.subtitle('Todas nuestras pizzas.')
.images([
builder.CardImage.create(session, 'http://www.cateringolivia.com.ar/fotos/ser2_1g.jpg')
.tap(builder.CardAction.showImage(session, 'http://mx.cdn01.mundotkm.com/2016/01/e9a9d35c744f3ff11a97e32274411d8b_large.jpeg')),
])
.buttons([
builder.CardAction.imBack(session, 'Pizza', 'Seleccionar')
]),
new builder.HeroCard(session)
.title('Parrilla')
.subtitle('Carne, Pollo, Achuras.')
.images([
builder.CardImage.create(session, 'https://media-cdn.tripadvisor.com/media/photo-s/03/85/0c/c7/parrilla-tour-buenos.jpg')
.tap(builder.CardAction.showImage(session, 'https://restorando-res.cloudinary.com/image/upload/s--L2hhcZz2--/c_fit,f_auto,h_500,w_700/v1416341745/restaurant_photos/x/6939/52684/restaurante_parrilla-atahualpa_centro_10390894_1485980544972645_3906330496111888189_n.jpg')),
])
.buttons([
builder.CardAction.imBack(session, 'Parrilla', 'Seleccionar')
])
]);
builder.Prompts.choice(session, msg, 'Pizza|Parrilla', {listStyle: builder.ListStyle.button});
},
(session, results) => {
session.beginDialog('/' + results.response.entity.toLowerCase());
}
]);
bot.dialog('/pizza', [
(session) => {
builder.Prompts.choice(session, 'Qué gusto desea pedir?', 'mozzarella|napolitana|jamon', {listStyle: builder.ListStyle.button});
},
(session, results) => {
session.endDialog('Ya estamos llevando una pizza de ' + results.response.entity + ' a tu casa. Que lo disfrutes!');
}
]);
bot.dialog('/parrilla', [
(session) => {
builder.Prompts.choice(session, 'Qué desea pedir?', 'vacio|pollo', {listStyle: builder.ListStyle.button});
},
(session, results) => {
session.endDialog('Ya estamos llevando el ' + results.response.entity + ' a tu casa. Que lo disfrutes!');
}
]);
};
服务器:亚马逊ec2中的Nodejs。在index.js中使用morgan:
app.use(morgan(':method :url :status - [:date[clf]] - :remote-addr - :response-time'));
有什么想法吗?