from server ; working with amazon test service, not working with real device

This commit is contained in:
Bilal
2018-01-08 12:44:38 +00:00
parent 51ff7f255c
commit 994670ce54

View File

@@ -61,21 +61,27 @@ alexaApp.express({
// from here on you can setup any other express routes or middlewares as nor
app.set("view engine", "ejs");
/*
alexaApp.launch(function(request, response) {
console.log("Alexa launch");
console.log(request);
/*
const skill = db.collection('skill_list').findOne({_id: ObjectID(skillDbID)}, (err,result)=>{
db.collection('skill_list').findOne({_id: ObjectID(skillDbID)}, (err,skill)=>{
if (skill){
console.log('pass');
return new Promise ((resolve,reject)=>{
}else{
console.log('error');
}
/*
if (err){
return response.say("I could not find desired skill")
console.log('error ' + err);
}else{
return response.say(skill.invocationAnswer);
//return response.say(result.invocationAnswer);
return response.say('Welcome');
console.log('Poslano');
}
});
*/
return response.say('Welcome to Saburly');
});
});*/
var findElementByAttr = function (data, attr, val){
for(var i = 0; i < data.length; i ++) {
@@ -110,7 +116,10 @@ var updateIntentsJSON = function(){
db.collection('skill_list').findOne({_id: ObjectID(skillDbID)}, (err, skill)=>{
if (skill){
skill.intents.map(intent => {
alexaApp.intent(intent.intentName,{'slots':[], 'utterances':intent.questions}, function(request,response){ response.say(intent.answer);});
alexaApp.intent(intent.intentName,{'slots':[], 'utterances':intent.questions}, function(request,response){ return response.say(intent.answer);});
});
alexaApp.launch((request,response)=>{
return response.say(skill.invocationAnswer);
});
}
});