简体   繁体   English

我可以在Bot Framework中使用轮播代替按钮提示用户吗?

[英]Can I prompt the user with carousels instead of buttons in the Bot Framework?

I would like to know if it is possible to have a PromptDialog with carousels instead of buttons. 我想知道是否可以使用带有轮播而不是按钮的PromptDialog。

For example, if I want to prompt the user with choices I can do something like this: 例如,如果要提示用户选择,可以执行以下操作:

public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> result)
{
    IEnumerable<string> options = new List<string>
    {
        "First Option",
        "Second Option",
        "Third Option",
        "Fourth Option"
    };

    PromptDialog.Choice(context, AfterPromptDialogChoice, options, "Choose an option");
}

private async Task AfterPromptDialogChoice(IDialogContext context, IAwaitable<string> result)
{
    string input = await result;
    await context.PostAsync(input);
    context.Wait(this.MessageReceivedAsync);
}

The key here for me is that after the user chooses an option I can handle the choice inside the AfterPromptDialogChoice method. 对我而言,关键是在用户选择一个选项之后,我可以在AfterPromptDialogChoice方法内处理该选择。 What I would like is to prompt the user with a carousel, and when he chooses one one of the carousel items I would like to redirect the flow to an delegate method where I can perform some operations based on the users choice. 我想用一个轮播提示用户,当他选择一个轮播项目时,我想将流程重定向到一个委托方法,我可以根据用户的选择执行一些操作。

I know that using a regular carousel I can use an CardAction to send back the option the user selected, however this option's value (text) will be send again to the bot and won't be related to the user choice. 我知道使用常规的轮播,我可以使用CardAction来发回用户选择的选项,但是该选项的值(文本)将再次发送给机器人,并且与用户的选择无关。 I just would like to have the behavior of the PromptDialog.Choice, but with a carousel to display the options, instead of only buttons Is that possible? 我只是想拥有PromptDialog.Choice的行为,但是有一个轮播显示选项而不是仅显示按钮,这可能吗?

You might have to provide your PromptStyler to the PromptOptions of the PromptChoice. 您可能需要提供您的PromptStylerPromptOptions的PromptChoice的。

The PromptStyler is the one responsible of applying the proper PromptStyle to the options. PromptStyler是负责将适当的PromptStyle应用于选项的人。

It's something that you would have to explore and see if it will suits all your needs. 您必须进行探索,看看它是否可以满足您的所有需求。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有提示按钮的主动消息传递-Microsoft Bot Framework - Proactive messaging with prompt buttons - Microsoft Bot Framework Bot Framework嵌入式聊天 - 我可以自定义提示吗? - Bot Framework Embedded Chat - Can I customize the prompt? 如何在不使用Microsoft Bot Framework中的PromptDialog的情况下提示用户 - How to Prompt user without using PromptDialog in Microsoft Bot Framework Telegram是否可以通过Bot Framework显示轮播? - Does Telegram have a way to show carousels with Bot Framework? 如何使用 c# 在电报机器人中使用斜杠命令列表而不是键盘按钮? - How can i do slash command list instead keyboard buttons in telegram bot using c#? 带有图像的Bot框架提示对话框 - Bot Framework Prompt Dialog with Image 如何将来自用户的消息存储在变量中? (微软机器人框架) - How can i store a message from the user in a variable? (Microsoft Bot Framework) 如何在 azure 多转 QnA Bot Framework V4 中添加自定义提示或获取用户输入 - How to add custom prompt or get user input in azure multi-turn QnA Bot Framework V4 使用Bot框架C#中的对话框,是否有任何简单的方法向用户提示查询顺序? - Is any simple way to prompt sequence of queries to the user using dialog in Bot framework C#? 如何对需要用户 select 在 Bot Framework 中选择的自定义提示进行单元测试 - How to unit test custom prompt that requires user select a choice in Bot Framework
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM