-
Notifications
You must be signed in to change notification settings - Fork 5
/
AI_RADIO
54 lines (43 loc) · 1.55 KB
/
AI_RADIO
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
intent('hello world', p => {
p.play('(hello|hi there)');
});
question(
'what this app can do?', 'what does this app do?',
reply('This is a radio app where you can ask me to play some music.'),
);
intent('play $(CHANNEL* (.*)) fm', p => {
let channel = project.radios.filter(x => x.name.toLowerCase() === p.CHANNEL.value.toLowerCase())[0];
try {
p.play({ "command": "play_channel", "id": channel.id });
p.play('(Playing Now|on it|yess sir|Doing it)');
} catch (err) {
console.log("Can't play");
p.play("I cannot play this");
}
});
intent('play (some|) $(CATEGORY* (.*)) music', p => {
let channel = project.radios.filter(x => x.category.toLowerCase() === p.CATEGORY.value.toLowerCase())[0];
try {
p.play({ 'command': 'play_channel', 'id': channel.id });
p.play('(playing now|On it|Ok sir)');
} catch (error) {
console.log("Can't play");
p.play('I could not find this genre');
}
});
intent('(play)', 'play (the|) (some|) music', p => {
p.play({ "command": "play" });
p.play("(Playing Now|on it|Ok sir|Doing it)");
});
intent('stop (it|)', 'stop (the|) music', 'pause (it|)', 'pause (the|) music', p => {
p.play({ "command": "stop" });
p.play("(Stopping Now|on it|Ok sir|Doing it)");
});
intent('(play|) next (channel|fm|radio|)', p => {
p.play({ "command": "next" });
p.play("(on it|Ok sir|Doing it|sure)");
});
intent('(play|) previous (channel|fm|radio|)', p => {
p.play({ "command": "prev" });
p.play("(on it|Ok sir|Doing it|sure)");
});