简体   繁体   English

将Azure Bot服务与不可配置的聊天服务一起使用

[英]Using Azure Bot Service with non-Channel-Configurable Chat Service

When I create a bot in Slack, I can use channel configuration on Azure Bot Service to receive event/message from Slack and communicate with my Web App Bot which handles various functions. 在Slack中创建漫游器时,可以使用Azure Bot Service上的通道配置从Slack接收事件/消息,并与处理各种功能的Web App Bot通信。

However, when I create a bot in a chat service which is not supported in channel configuration (eg, Discord), I need to set up a client in my Web App Bot (eg, Discord.Net) to communicate with the service. 但是,当我在聊天服务中创建一个漫游器时,通道配置不支持该漫游器(例如Discord),我需要在Web App Bot(例如Discord.Net)中设置一个客户端以与该服务进行通信。

Then, although I guess the Direct Line channel (REST API) will handle communication between the Web App Bot and Bot Service, but am not sure if it's correct. 然后,尽管我猜想直线通道(REST API)将处理Web App Bot与Bot服务之间的通信,但不确定是否正确。 Is my assumption right? 我的假设正确吗?

Also, it is not clear for me if there's an advantage of using Bot Service in this situation, because simply I may host an individual web app on Azure or another location and let it communicate with the chat service. 另外,对于这种情况,使用Bot Service是否有优势对我还不清楚,因为我可以将单个Web应用程序托管在Azure或其他位置,并使其与聊天服务进行通信。 Why do I need to add one more service to handle? 为什么需要添加一项服务来处理?

I suppose that one possible advantage could be that I can easily access various features (eg, LUIS) via the Bot Service. 我想一个可能的优点是,我可以通过Bot Service轻松访问各种功能(例如LUIS)。 Also, the bot can handle various platform like Skype or Cortana with one code. 此外,该机器人还可以使用一个代码处理各种平台,例如Skype或Cortana。

But still I don't really understand this topic. 但是我还是不太了解这个话题。 Could anyone give me a suggestion and best practice? 谁能给我建议和最佳做法?


Below is my current understanding, it could be wrong though. 以下是我目前的理解,但这可能是错误的。

在此处输入图片说明

Directline API isn't the easiest to work with, and making a Bot Framework bot work with Discord is going to take a good amount of work. Directline API并不是最容易使用的,要使Bot Framework机器人与Discord一起工作将需要大量工作。 But the purpose of the Directline is to be the connection between your bot (Azure Bot Service/Web App Bot) and Discord. 但是Directline的目的是使您的机器人(Azure Bot服务/ Web App Bot)与Discord之间建立连接。 To use the Directline API, you're going to: 要使用Directline API,您需要执行以下操作:

1) Get your directline secret by registering your bot on Azure (Azure Bot Services) 1)通过在Azure上注册您的机器人来获取您的直线机密(Azure Bot Services)

2) Create your directline object, using above secret (this is the line of communication between ABS and Discord) 2)使用以上秘密创建您的直线对象(这是ABS和Discord之间的通信线)

3) Use your directline object to POST activities to the bot from the user and Listen for activities from the bot 3)使用您的直线对象将用户的活动发布到机器人,并监听机器人的活动

4) Additional purposes not related to conversation: your directline object will monitor connection status of your websockets, and keep the token refreshed for the conversations 4)与对话无关的其他目的:您的直接对象将监视WebSocket的连接状态,并保持对话的令牌刷新

The Directline-js repo has a good README and code samples, but bear in mind that the framework is constantly being improved. Directline-js存储库具有良好的自述文件和代码示例,但请记住,该框架正在不断改进。 As of this writing, there are 8 pull requests waiting for review for the repo. 在撰写本文时,有8个请求请求正在等待回购的审查。

The AI Help Website wrote a preview back in July 2018 (before the release of v4) on how to use the Directline API with C# AI帮助网站早在2018年7月(v4发行之前)就编写了有关如何在C#中使用Directline API的预览版

And finally, the official documentation for the Directline API is here 最后,Directline API的官方文档在这里

As for connecting your bot with Discord, the Discord API reference has instructions on how to get your authorization token here . 至于将您的机器人与Discord连接起来,Discord API参考在此处提供了有关如何获取授权令牌的说明。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM