简体   繁体   English

Bot在Microsoft Teams中的行为不同

[英]Bot acts differently in Microsoft Teams

I've deployed my Bot to Webchat, Skype and MS Teams. 我已将我的Bot部署到Webchat,Skype和MS团队。

In OnTurnAsync method I check, if the user input begins with bnr then I call a specific method. OnTurnAsync方法中我检查,如果用户输入以bnr开头,那么我调用一个特定的方法。

if (turnContext.Activity.Text.ToLower().StartsWith("bnr"))
{
    string msg = RequestHandler.BnrCaller(turnContext.Activity.Text);
    await turnContext.SendActivityAsync(msg);
    return;
}

It works fine with Skype and Webchat but with teams it does not work 100%, It works just sometimes. 它适用于Skype和Webchat,但是对于团队而言,它不能100%工作,它有时会起作用。

[Edit] [编辑]

I found out, that it does not work if I copied the input into the input field but when I type it, it works fine! 我发现,如果我将输入复制到输入字段但是当我输入它时,它不起作用,它工作正常!

The Messages coming from the Teams are having a different structure. 来自团队的消息具有不同的结构。 The message text begins with the words <at>...</at> . 消息文本以<at>...</at>开头。 You need to delete this beginning in a Middleware component, etc. Try to look at your incoming messages through NGROK at localhost:4040 in your web browser. 您需要在中间件组件等中删除此开头。尝试通过Web浏览器中的localhost:4040通过NGROK查看传入消息。

So, I found out the issue by dint of app-insights. 所以,我通过app-insights发现了这个问题。

I've added a middleware , which logs the request body into app-insights and just realized, that when I copy/paste a message like: "Hello", it would be logged in app-insights as something like this "\\r\\n\\n\\rHello\\r\\n\\n\\r\\n". 我添加了一个middleware ,它将请求正文记录到app-insights中,并且意识到,当我复制/粘贴一条消息时,如“Hello”,它将被记录在app-insight中,就像这样的东西“\\ r \\” ñ\\ n \\ rHello \\ r \\ n \\ n \\ r \\ n”。 When I type it, it would be logged just fine. 当我输入它时,它会记录得很好。 So I jsut remove these symboles from the request and it works! 所以我jsut从请求中删除这些符号,它的工作原理!

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

相关问题 如何在 MS teams bot 中安排和发送消息 - How to schedule and send the message in MS teams bot 从 Controller 向 Microsoft Teams 发送消息 - Send message from Controller to Microsoft Teams 是否支持在NET Core中为Microsoft Teams创建扩展? - Is creating extensions for Microsoft Teams in NET Core supported? 我可以在 Teams #Bot 框架中刷新聊天历史记录吗 - Can i refresh Chat history in Teams #Bot framework 使用 Bot Framework V4 在 Teams 中发送主动一对一消息 - Send Proactive 1:1 message in Teams using Bot Framework V4 单个 Microsoft Bot 框架中的 Luis + CustomVision - Luis + CustomVision in a single Microsoft Bot Framework 在 Microsoft Bot framework V4 中从 Bot 向用户发送 Excel 文件 - Sending an Excel file from Bot to User in Microsoft Bot framework V4 使用 c# 和 Micorsoft bot 框架中的 v4 版本在聊天机器人中使用 Microsoft Bot Framework 设置计时器 - Set Timer Using Microsoft Bot Framework in chat bot using c# and v4 version in Micorsoft bot framework 在.net Framework而不是.netcore中创建Microsoft Bot项目? - Create a Microsoft Bot Project in .net Framework instead of .netcore? 使用Microsoft.Bot.Builder.Azure(bot Framework v4)为CosmosDB中的容器中的项目设置时间限制 - Set time limit for items in container in CosmosDB using Microsoft.Bot.Builder.Azure (bot framework v4)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM