-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
test.js
35 lines (29 loc) · 1.09 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var readlineSync = require('readline-sync');
var chatskills = require('./lib/chatskills');
// Create a new skill.
var hello = chatskills.add('hello');
// Create a new intent.
hello.intent('helloWorld', {
'slots': {},
'utterances': [ '{to |}{say|speak|tell me} {hi|hello|howdy|hi there|hiya|hi ya|hey|hay|heya}' ]
},
function(req, res) {
res.say('Hello, World!');
}
);
// Include some other skills.
require('./funny');
require('./horoscope');
require('./favoritecolor');
require('./pickfruit');
require('./dateplanner');
console.log('Welcome, here are some available commands to try:\nchatskills, ask hello to say hi\nchatskills, ask horoscope for Aries\nchatskills, ask funny to tell a joke\nchatskills, ask favoritecolor to run\nchatskills, ask pickfruit to run\nchatskills, ask dateplanner to run\n');
// Example client.
var text = ' ';
while (text.length > 0 && text != 'quit') {
text = readlineSync.question('> ');
// Respond to what was typed.
chatskills.respond(text, function(response) {
console.log(response);
});
}