Step 4 #5

Merged
senaduka merged 24 commits from step-4 into master 2018-01-15 14:59:31 +01:00
Showing only changes of commit 7fbc105433 - Show all commits

View File

@@ -68,14 +68,13 @@ alexaApp.request = (jsonRequest) => {
if (alexaRequest.type() === "IntentRequest") {
db.collection('skill_list').findOne({_id: ObjectID(skillDbID)}, (err,skill)=>{
if (skill) {
console.log(alexaRequest.data.request.intent);
let intentId = findElementByAttr(skill.intents, 'intentName', alexaRequest.data.request.intent.name);
console.log(alexaRequest.data.request.intent.name);
console.log(intentId);
const response = new alexa.response(alexaRequest.getSession());
if (intentId !== -1){
response.say(skill.intents[intentId].answer);
return response.say(skill.intents[intentId].answer);
}else{
response.say('Sorry, I could not find desired intent');
return response.say('Sorry, I could not find desired intent');
}
}
});