如何从v4 Bot返回打字活动 [英] How do I return a Typing activity from my v4 Bot

查看:96
本文介绍了如何从v4 Bot返回打字活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Typing活动添加到我的bot中长时间运行的动作中,但是我一直收到"BadGateway"错误.我发现的大多数示例似乎都是针对bot框架v3的,因此不再出现类型或方法,因此我尝试了v4的一些选项(使用C#),如下所示:

I'm trying to add a Typing activity to a long-running action in my bot, but I keep getting a "BadGateway" error. Most of the samples I've found seem to be for bot framework v3, so the types or methods don't appear any more, and I've tried a few options for v4 (using C#), like the following:

await turnContext.SendActivityAsync(new Activity() { Type = ActivityTypes.Typing });

var typingActivity = new Activity()
{
    Type = ActivityTypes.Typing
    //RelatesTo = turnContext.Activity
};

typingActivity.ApplyConversationReference(typingActivity.GetConversationReference());

var act2 = MessageFactory.Text(null);
act2.Type = ActivityTypes.Typing;
await turnContext.SendActivityAsync(act2);

所有这些都会导致BadGateway错误.

all of these result in a BadGateway error.

有人可以指导我解决我的问题吗?

Can someone guide me on where I'm going wrong?

推荐答案

Steven Kanberg的答案具有正确的代码,但不幸的是,这是当前的服务问题,已在

The answer of Steven Kanberg has the right code, but unfortunately this is a service issue at the moment, as confirmed in this issue on Github.

问题解决后,应将其发布在上面的Github问题中.

When the issue is resolved, it should be posted in the Github issue above.

这篇关于如何从v4 Bot返回打字活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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