简体   繁体   English

Nodejs和microsoft bot框架

[英]Nodejs and microsoft bot framework

I am looking at the nodejs code here https://github.com/Microsoft/BotBuilder/blob/master/Node/examples/basics-waterfall/app.js 我在这里查看nodejs代码https://github.com/Microsoft/BotBuilder/blob/master/Node/examples/basics-waterfall/app.js

I am trying to understand this piece of code 我试图理解这段代码

var bot = new builder.UniversalBot(connector, [
    function (session) {
        ...
    },
    function (session, results) {
        ...
    },
    function (session, results) {
       ...
    },
    function (session, results) {
        ...
    }
]);

I understand that var bot is a function expression and takes in two parameters one is a connector and another is an array of functions. 我知道var bot是一个函数表达式,它接受两个参数,一个是连接器,另一个是函数数组。

Do these array of functions execute serially in the order they are defined ? 这些函数数组是按照它们定义的顺序串行执行的吗?

Comming from another programming background i am not familiar with this dialect. 来自另一个编程背景,我不熟悉这种方言。

How can i make this program more C# like is async await the answer ? 我如何使这个程序更像C#as async等待答案?

If async await is the answer how do i convert this to use the async/await paradigm ? 如果async await是答案,我如何将其转换为使用async / await范例?

Yes, it seems like they are executing in the order they are defined. 是的,似乎他们按照定义的顺序执行。

You are supposed to provide only the function body in that array, the actual execution happens somewhere in the bot implementation, so you'd have to look there to get a clearer picture. 你应该只提供该数组中的函数体,实际的执行发生在bot实现的某个地方,所以你必须在那里寻找更清晰的图像。

But judging from that example and common sense, it's clear that they are executed sequentially. 但从这个例子和常识来看,很明显它们是按顺序执行的。 It's a bot that answers questions in the order they are defined. 它是一个机器人,按照定义的顺序回答问题。

I'm not sure what you understand by "async" in this context, but if you want it to answer arbitrary requests, you can look at the other examples like basics-logging . 我不确定你在这个上下文中对“async”的理解是什么,但是如果你想让它回答任意请求,你可以看看其他例子,比如basics-logging

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

相关问题 带有Azure Functions应用程序和NodeJS的Microsoft Bot Framework - Microsoft Bot Framework with Azure Functions App and NodeJS 使用NodeJS中的Microsoft Bot Framework将Excel内容作为附件发送 - Sending Excel Content as attachment using Microsoft Bot Framework in NodeJS 如何在 Microsoft Bot Framework 中嵌入 html 表单 - nodejs - How to embed html form in Microsoft Bot Framework - nodejs 使用 Bot Framework 通过 NodeJS 发布到 Microsoft Teams 频道 - Using the Bot Framework to post to a Microsoft Teams channel with NodeJS 在回调中使用await(Microsoft Bot Framework v4 nodejs) - use await inside callback (Microsoft Bot Framework v4 nodejs) 在 Microsoft Bot Framework v4 中处理自适应卡片 - Nodejs - Handling Adaptive cards in Microsoft Bot Framework v4 - Nodejs 在Microsoft Bot Framework v4 for NodeJS中处理HeroCards响应 - Handling HeroCards responses In Microsoft Bot Framework v4 for NodeJS Microsoft Web Bot Node.js中的Cookie - Cookies in microsoft web bot nodejs Microsoft Bot Framework V4 Appinsights 相关信息? 如何使用 Nodejs 将其用于自定义指标和自定义事件? - Microsoft Bot Framework V4 Appinsights related information ? How to use it for custom metric and custom events using Nodejs? 在AWS Lambda 401上运行的Microsoft Bot Framework NodeJS V4未授权错误 - Microsoft Bot Framework NodeJS V4 running on AWS Lambda 401 unauthorized error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM