Toggle navigation
Toggle navigation
This project
Loading...
Sign in
윤동주
/
LINEBOT
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
최한솔
2019-12-04 23:39:12 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a613dd035a72e324035108161f37586d18f88110
a613dd03
1 parent
bff59378
time value test
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
dialogflowFulfillment/firebase/functions/index.js
dialogflowFulfillment/firebase/functions/index.js
View file @
a613dd0
...
...
@@ -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
);
});
...
...
Please
register
or
login
to post a comment