This commit is contained in:
Bilal
2018-01-07 17:51:07 +00:00
parent 675861d2cd
commit 7fbc105433

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');
}
}
});