Botframework 微软机器人程序框架

Botframework 微软机器人程序框架,botframework,Botframework,我正在尝试建立一个对话机器人。当我试图用next传递响应时,它不会反映在下一个函数中 bot.dialog('Barcode', (session, args, next) => { var intent = args.intent; var id = builder.EntityRecognizer.findEntity(intent.entities, 'Report.Id'); if (id) { n

我正在尝试建立一个对话机器人。当我试图用next传递响应时,它不会反映在下一个函数中

bot.dialog('Barcode',
    (session, args, next) => {
        var intent = args.intent;
        var id = builder.EntityRecognizer.findEntity(intent.entities, 'Report.Id');
          if (id) {
            next({ response: id.entity });

        } else {
            builder.Prompts.text(session, 'Please enter your id');
        }
      session.endDialog();
    }  ,
      (session,results) => {

          var id = results.response;
           session.send(id.toString());  -- i want the value to be passed here 
      }
).triggerAction({
    matches: 'Barcode'
})

如果要在对话框中实现工作流,可以在
dialog()
函数的第二个参数中设置
IDialogWaterfallStep | IDialogWaterfallStep[]

在代码中,您忘记了在步骤之外介绍
[]

尝试:

bot.dialog('Barcode',[
    (session, args, next) => {
        var intent = args.intent;
        var id = builder.EntityRecognizer.findEntity(intent.entities, 'Report.Id');
          if (id) {
            next({ response: id.entity });

        } else {
            builder.Prompts.text(session, 'Please enter your id');
        }
      session.endDialog();
    }  ,
      (session,results) => {

          var id = results.response;
           session.send(id.toString());  -- i want the value to be passed here 
      }]
).triggerAction({
    matches: 'Barcode'
})