2
저는 봇 프레임 워크를 처음 사용하고 노드 SDK를 사용하여 스카이프 채팅 봇에서 작업하고 있습니다.Skype chat bot framework - node.js
트리 데이터의 ID와 이름을 제공하는 JSON 트리 배열이 있습니다. 트리에서 타이틀을 얻기위한
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;
});
배열
나는 ID가 잘 작동하지만 하나 개의 배열에 제목을 얻으려면 나는이 오류 얻을 얻으려고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);
:
/node_modules/promise/lib/done.js:10
throw err;
^
TypeError: choice.trim is not a function