Wednesday 7 June 2017

Multiple buttons in HeroCard

I'd like to have multiple buttons on HeroCard and be able to press all buttons one after another but when I press click button program jumps to next function in waterfall and expects next action instead of button action again what should I do in this case?

bot.dialog("/showCards", [
    (session) => {
        const url = "https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png";
        const msg = new Message(session)
            .textFormat(TextFormat.xml)
            .attachmentLayout(AttachmentLayout.carousel)
            .attachments([{
                title: "title",
                url: "https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png"
            }].map(obj =>
                new HeroCard(session)
                    .title(obj.title)
                    .images([
                        CardImage.create(session, obj.url)
                            .tap(CardAction.showImage(session, obj.url)),
                    ])
                    .buttons([
                        CardAction.openUrl(session, obj.url),
                        CardAction.imBack(session, `click`, "Click"),
                        CardAction.imBack(session, `clack`, "Clack")
                    ])
            ));
        Prompts.choice(session, msg, ["click", "clack"]);

    },
    (session, results) => {
        // todo use results.response.entity
    }
]);



via Trej Gun

No comments:

Post a Comment