Skip to content
This repository was archived by the owner on Mar 8, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions lambda/custom/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ const states = {
SEARCHMODE: '_SEARCHMODE',
DESCRIPTION: '_DESKMODE',
};
// local variable holding reference to the Alexa SDK object
let alexa;

//OPTIONAL: replace with "amzn1.ask.skill.[your-unique-value-here]";
let APP_ID = undefined;

Expand Down Expand Up @@ -97,7 +94,7 @@ const newSessionHandlers = {
const startSearchHandlers = Alexa.CreateStateHandler(states.SEARCHMODE, {
'AMAZON.YesIntent': function () {
output = welcomeMessage;
alexa.response.speak(output).listen(welcomeMessage);
this.response.speak(output).listen(welcomeMessage);
this.emit(':responseReady');
},

Expand Down Expand Up @@ -180,28 +177,28 @@ const startSearchHandlers = Alexa.CreateStateHandler(states.SEARCHMODE, {
}

output += eventNumberMoreInfoText;
alexa.response.cardRenderer(cardTitle, cardContent);
alexa.response.speak(output).listen(haveEventsreprompt);
this.response.cardRenderer(cardTitle, cardContent);
this.response.speak(output).listen(haveEventsreprompt);
} else {
output = NoDataMessage;
alexa.emit(output).listen(output);
this.response.speak(output).listen(output);
}
}
else {
output = NoDataMessage;
alexa.emit(output).listen(output);
this.response.speak(output).listen(output);
}
} else {
output = NoDataMessage;
alexa.emit(output).listen(output);
this.response.speak(output).listen(output);
}
});
this.emit(':responseReady');
}.bind(this));
}
else{
this.response.speak("I'm sorry. What day did you want me to look for events?").listen("I'm sorry. What day did you want me to look for events?");
this.emit(':responseReady');
}

this.emit(':responseReady');
},

'AMAZON.HelpIntent': function () {
Expand Down Expand Up @@ -292,7 +289,7 @@ const descriptionHandlers = Alexa.CreateStateHandler(states.DESCRIPTION, {

// register handlers
exports.handler = function (event, context, callback) {
alexa = Alexa.handler(event, context);
const alexa = Alexa.handler(event, context);
alexa.appId = APP_ID;
alexa.registerHandlers(newSessionHandlers, startSearchHandlers, descriptionHandlers);
alexa.execute();
Expand Down