-
Notifications
You must be signed in to change notification settings - Fork 0
/
Example2.Step4.js
36 lines (32 loc) · 1.15 KB
/
Example2.Step4.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
36
"use strict";
var Alexa = require("alexa-sdk");
var handlers = {
"LaunchRequest": function () {
this.response.speak("Welcome to HASTAC Conference skill.");
this.emit(':responseReady');
},
"HelloHASTACIntent": function () {
this.response.speak("Hello there.");
this.emit(':responseReady');
},
//We are going to modify this code to let the user choose what they are looking for.
"LocationHASTACIntent": function () {
if (this.event.request.intent.slots.location.value == "cafeteria"){
this.response.speak("Knightros is located behind the CFE Arena. You can find the arena at H3 or G4 on the maps around campus.");
this.emit(':responseReady');
}
else if (this.event.request.intent.slots.location.value == "student union"){
this.response.speak("The student union is located at the middle of campus.");
this.emit(':responseReady');
}
else {
this.response.speak("What are you trying to find?").listen("Sorry, what are you looking for?");
this.emit(':responseReady');
}
}
}
exports.handler = function(event, context, callback){
var alexa = Alexa.handler(event, context);
alexa.registerHandlers(handlers);
alexa.execute();
}