为什么我获得typeError:dialog.addialogtrigger不是一个函数



我的机器人不再起作用:如果我将任何消息发送到"/"对话框或其他对话框(例如"/菜单"(。我总是会遇到相同的错误" typeerror:dialog.addialogtrigger不是函数"

bot信息:

  1. SDK平台:node.js
  2. SDK版本:Botbuilder 3.14.0

部署环境:

  1. Azure Bot Service
  2. 模拟器的本地开发

代码示例

bot.dialog('menu', require("./dialogs/menu"))
    .triggerAction({
        matches: /^#menuderungly$/i
    });

任何想法如何应对?非常感谢您的帮助!

似乎您正在尝试调用另一个文件上的对话框。在这种情况下,您必须像任何其他nodejs函数一样声明该文件中的对话框:

parentdialog.js

var childrenDialogs = require('./childrenDialogs'); 
...
...
// this is where the base dialog handles the conversation over to another dialog
bot.dialog('/', childrenDialogs.childDialog1); 

childrendialogs.js:

exports.childDialog1 = (session) => {
    // something in this dialog
}

我希望这会有所帮助。干杯!:)

最新更新