I'm new to the bot framework and working on the skype chat bot by using node SDK.
I have JSON tree array which provide me the id and names for tree data.
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}]
}
]
});
Code for get the title from tree.
var node1 = treeName.first(function (node) {
return node.model.id === 1;
});
Array
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 );
When I'm trying to get the id it will work well but if I want to get title in one array then I get this error:
/node_modules/promise/lib/done.js:10
throw err;
^
TypeError: choice.trim is not a function