簡體   English   中英

如何使用 bot 框架在 bot.on 中放置輪播?

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

我有一個帶有機器人框架的聊天機器人,我想在bot.on中的第一條消息中使用它,但我不知道該怎么做。

(img "法國國旗") | (img "國旗英語") | (img“西班牙國旗”)

按鈕“法語” | 按鈕“英文” | 按鈕“西班牙語”

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

我應該使用帶 3 張卡的旋轉木馬嗎? 但我不知道如何在bot.on中做到這一點

有誰知道該怎么做?

好的,我找到了!

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);
            }
        });
    }
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM