nbp-skills-cluster
v0.0.2
Published
This is a Node.js Bot Platform skills cluster with ability to build part of the global decision tree and run tree traverse.
Downloads
1
Readme
Skills Cluster
This is a Skills Cluster for Node.js Bot Platform. Abilities of this Cluster:
- plug different Skills;
- build part of decision tree (a queue) of skills;
- run traverse.
Skill
You can define a skill as an object with name and lambda fields:
const skill = {
name: 'skillName',
lambda: function(context) {
return Promise.resolve(context);
}
};
Skill always should return a Promise, which resolve a context. Context is usually consist of services, that current bot used, and rules:
const skillLambda = function({ bot, rules }) {
// The list of services is dependent on route-builder.js in Node.js Bot Platform repository
// bot.storage
// bot.memcached
// bot.messenger
return Promise.resolve({ bot, rules });
}
Please, look at usage example.