from server ; working with amazon test service, not working with real device
This commit is contained in:
@@ -61,21 +61,27 @@ alexaApp.express({
|
|||||||
// from here on you can setup any other express routes or middlewares as nor
|
// from here on you can setup any other express routes or middlewares as nor
|
||||||
|
|
||||||
app.set("view engine", "ejs");
|
app.set("view engine", "ejs");
|
||||||
|
/*
|
||||||
alexaApp.launch(function(request, response) {
|
alexaApp.launch(function(request, response) {
|
||||||
console.log("Alexa launch");
|
console.log("Alexa launch");
|
||||||
console.log(request);
|
db.collection('skill_list').findOne({_id: ObjectID(skillDbID)}, (err,skill)=>{
|
||||||
/*
|
if (skill){
|
||||||
const skill = db.collection('skill_list').findOne({_id: ObjectID(skillDbID)}, (err,result)=>{
|
console.log('pass');
|
||||||
|
return new Promise ((resolve,reject)=>{
|
||||||
|
}else{
|
||||||
|
console.log('error');
|
||||||
|
}
|
||||||
|
/*
|
||||||
if (err){
|
if (err){
|
||||||
return response.say("I could not find desired skill")
|
return response.say("I could not find desired skill")
|
||||||
|
console.log('error ' + err);
|
||||||
}else{
|
}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){
|
var findElementByAttr = function (data, attr, val){
|
||||||
for(var i = 0; i < data.length; i ++) {
|
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)=>{
|
db.collection('skill_list').findOne({_id: ObjectID(skillDbID)}, (err, skill)=>{
|
||||||
if (skill){
|
if (skill){
|
||||||
skill.intents.map(intent => {
|
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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user