且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

函数过早返回过滤器并降低了效果

更新时间:2023-02-16 21:14:08

app.ask()将响应发送回用户(并且,因为您使用的是 ask()而不是 tell(),也表示保持麦克风打开)。它完全返回Express的 Response.send()方法返回的内容。

app.ask() sends the response back to the user (and, since you're using ask() and not tell(), also says to keep the microphone open). It returns exactly what Express' Response.send() method returns.

将字符串返回到调用函数。

It does not return the string to the calling function.

如果需要该值,则不应调用 app.ask()此时。只需返回值(或最终会解决该值的Promise),然后调用 app.ask()

If you want the value, you shouldn't call app.ask() at this point. Just return the value (or a Promise that eventually resolves to that value) and have that call app.ask().