简体   繁体   中英

how can i put a carousel in bot.on with bot framework?

I have a chatbot with bot framework and I want to have this for my first message in but I don't know how can I do it.中的第一条消息中使用它,但我不知道该怎么做。

Choose your language / Choisissez votre langue:

(img "flag french") | (img "flag english") | (img "flag spanish")

button "français" | button "english" | button "spanish"

bot.on('conversationUpdate', function (message) {
    if (message.membersAdded) {
        message.membersAdded.forEach((identity) => {
            if (identity.id == message.address.bot.id) {
                CODE HERE
            }
        });
    }
});

Should I use a carousel with 3 card? but I don't know how to do it in 中做到这一点

Does anyone know how to do it?

ok, I find it !

bot.on('conversationUpdate', function (message) {
    if (message.membersAdded) {
        message.membersAdded.forEach((identity) => {
            if (identity.id == message.address.bot.id && message.source != 'skypeforbusiness') {
                console.log(message);
                bot.send(new builder.Message()
                    .address(message.address)
                    .text('Choose your language :')
                );
                setTimeout(function () {
                    bot.send(new builder.Message()
                        .address(message.address)
                        .attachmentLayout(builder.AttachmentLayout.carousel)
                        .attachments([
                            new builder.HeroCard()
                                .title()
                                .subtitle()
                                .text()
                                .images([builder.CardImage.create(null, '')])
                                .buttons([
                                    builder.CardAction.imBack(null, "English", "English")
                                ]),
                            new builder.HeroCard()
                                .title()
                                .subtitle()
                                .text()
                                .images([builder.CardImage.create(null, '')])
                                .buttons([
                                    builder.CardAction.imBack(null, "Français")
                                ]),
                            new builder.HeroCard()
                                .title()
                                .subtitle()
                                .text()
                                .images([builder.CardImage.create(null, '')])
                                .buttons([
                                    builder.CardAction.imBack(null, "Español", "Español")
                                ])
                        ])
                    );
                }, 1000);
            }
        });
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM