botframework确认对话框,以用户身份发送消息 [英] botframework confirm dialog, send message as user

查看:64
本文介绍了botframework确认对话框,以用户身份发送消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个确认对话框,用户可以在其中选择是/否

I have created a confirm dialog where the user can select yes/no

 private async Task Confirm(IDialogContext context, IAwaitable<bool> result)
        {
            var res= await result;
            await context.PostAsync(res? "Proceed" : "Ok then");
            if (res) {
                ......
            }
        }

如果用户选择是,他将收到消息继续" 同时(再次,如果"res"为真),我想发送一个 向机器人发送的特定消息,但不会出现在对话中. 当用户使用时,有没有一种方法可以将自定义消息发送回机器人 按是吗?

If the user selects Yes he will receive the message "Proceed" At the same time (again if "res" is true), i want to send a specific message to the bot without appearing in the conversation. Is there a way to send a custom message back to the bot when user press Yes?

推荐答案

您可以尝试使用存储在context中的数据来构造新活动,您可以使用此方法访问该数据.我不完全了解您的情况,但这似乎可以满足您的需求.

You could try constructing a new activity using data stored in the context which you have access to in this method. I don't fully understand your scenario but it seems this may work for what you need.

var a = new Activity();
a.Conversation = context.Activity.Conversation;
a.Recipient = context.Activity.Recipient;
a.From = context.Activity.From;
a.Id = context.Activity.Id;
...    //set whatever else you need set
a.Text = "Whatever you need the text to be";

//send or process the activity do what it is you are trying to accomplish

我认为您实际上正在寻找的是

I think what you are actually looking for is Prompt.Confirm().

这篇关于botframework确认对话框,以用户身份发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆