我想使用Microsoft bot框架为facebook messenger制作如下图所示的旋转木马
export function SuboffertCard(subOffert: SubOffertCard, session?: builder.Session) {
return new builder.HeroCard(session)
.title(subOffert.title)
.subtitle(subOffert.subtitle)
.images([
builder.CardImage.create(session, subOffert.image)
.tap(builder.CardAction.showImage(session, subOffert.image)),
])
.buttons([
builder.CardAction.imBack(session, `select:get_${subOffert.title}`, polyglot.t("select")),
builder.CardAction.imBack(session, `select:info_${subOffert.title}`, polyglot.t("info"))
])}
在app.ts中:
let msg = new builder.Message(session)
.attachmentLayout(builder.AttachmentLayout.carousel)
.attachments(subOfferts.map(subOffert => SuboffertCard(subOffert, session)));
builder.Prompts.choice(session, msg, subOfferts.map(subOffert => `select:get_${subOffert.title} | select:info_${subOffert.title}` ));
但无论我点击哪个按钮,都会收到相同的有效负载。