Skype聊天僵尸框架 – node.js

我是新来的僵尸框架,并通过使用节点SDK工作在Skype聊天机器人。

我有JSON树数组,它提供了树数据的ID和名称。

treeName = tree.parse({ "id": 1, "title": "menu", "children": [ { "id": 11, "title": "company _ data", "children": [{"id": 111}] }, { "id": 12, "title": "adhoc data test ", "children": [{"id": 121}, {"id": 122}] }, { "id": 13, "title": "quit", "children": [{"id": 131}, {"id": 132}] } ] }); 

代码从树中获得标题。

 var node1 = treeName.first(function (node) { return node.model.id === 1; }); 

排列

 var firstChild = []; for (var i = 0; i < node1.model.children.length; i++) { firstChild.push(node1.model.children[i].title); } builder.Prompts.choice(session, "What scenario would you like to run? ",firstChild ); 

当我试图获得ID它会工作,但如果我想在一个数组中获得标题,那么我得到这个错误:

 /node_modules/promise/lib/done.js:10 throw err; ^ TypeError: choice.trim is not a function 

您似乎没有在任何地方定义variables“select”。

 treeName.title 

要么

 treename.children[X].title 

在这种情况下,第一个将返回“菜单”,而第二个返回“company_data”或“adhoc data test”等。

您不能在数组或对象上使用.trim()。

编辑:看看我发现… https://github.com/Microsoft/BotBuilder/issues/2004