-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
horoscope.js
33 lines (30 loc) · 1014 Bytes
/
horoscope.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
var chatskills = require('./lib/chatskills');
// Create a new skill.
var horoscope = chatskills.add('horoscope');
// Create intents, using a dictionary.
horoscope.dictionary = {"signs":['aries','taurus','gemini','cancer','leo','virgo','libra','scorpio','sagittarius','capricorn','aquarius','pisces']};
horoscope.intent('predict', {
'slots': {'SIGN':'LITERAL'},
'utterances': [ 'for {signs|SIGN}',
'{signs|SIGN}' ]
},
function(req, res) {
var sign = req.get('SIGN');
if (horoscope.dictionary['signs'].indexOf(sign.toLowerCase()) != -1) {
res.say('Things are looking up today for ' + req.get('SIGN') + '.');
}
else {
res.say("I'm not familiar with that zodiac sign.");
return true;
}
}
);
horoscope.intent('*', {
'slots': {},
'utterances': [ '{*}' ]
},
function(req, res) {
res.say('What is your zodiac sign?');
return true;
}
);