최한솔

time value test

......@@ -21,12 +21,35 @@ exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, resp
agent.add(`잘못된 입력값 입니다`);
}
var mytime;
function test1(agent){
const mytime = agent.parameters.hours;
agent.setContext();
agent.add('수면 시간이 등록되었습니다');
const mytime = agent.parameters.hours;
const myresult = mytime+12;
if(mytime>0){
agent.add(`Good. your sleep time is ${myresult}`);
}
}
function test2(agent) {
const hour = agent.parameters.hours;
const min = agent.parameters.minutes;
const gothour = hour.length > 0;
const gotmin = min.length > 0;
const rehour = (hour)+3;
const remin = min+10;
if(gothour && gotmin) {
agent.add(`좋습니다. 당신의 취침시간은 ${hour}${min}분 입니다.`);
agent.add(`${rehour}${remin}분에 주무십시오`);
} else if (gothour && !gotmin) {
agent.add('시간이 잘못 입력되었습니다.');
} else if (gothour && !gothour) {
agent.add('시간이 잘못 입력되었습니다.');
} else {
agent.add('취침시간을 00:00 또는 00시00분 으로 입력해 주세요');
}
}
// // Uncomment and edit to make your own intent handler
// // uncomment `intentMap.set('your intent name here', yourFunctionHandler);`
// // below to get this function to be run when a Dialogflow intent is matched
......@@ -60,7 +83,6 @@ exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, resp
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set('test',test1);
// intentMap.set('your intent name here', googleAssistantHandler);
intentMap.set('test',test2);
agent.handleRequest(intentMap);
});
......