Toggle navigation
Toggle navigation
This project
Loading...
Sign in
오세헌
/
Ingredient-to-Dish-ChatBot
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
전언석
2022-06-06 15:45:20 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c6692242580b2a1a597e3c751a5260bc001521f1
c6692242
1 parent
b3a07aff
EDIT : when ingredients are more than 2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
I_to_D_chatbot/reply.js
I_to_D_chatbot/reply.js
View file @
c669224
...
...
@@ -40,9 +40,12 @@ app.post('/hook', function (req, res) {
var
index
=
0
;
var
istrue
=
false
;
for
(
var
i
=
0
;
i
<
results
.
length
;
i
++
)
{
if
(
results
[
i
].
ingredients
===
message
.
text
)
{
index
=
i
;
istrue
=
true
;
var
ingredients_list
=
results
[
i
].
ingredients
.
split
(
", "
);
for
(
var
j
=
0
;
j
<
ingredients_list
.
length
;
j
++
)
{
if
(
ingredients_list
[
j
]
===
message
.
text
)
{
index
=
i
;
istrue
=
true
;
}
}
}
if
(
istrue
)
{
...
...
@@ -61,6 +64,10 @@ app.post('/hook', function (req, res) {
},
{
"type"
:
"text"
,
"text"
:
`필요한 재료는\n
${
results
[
index
].
ingredients
}
입니다.`
},
{
"type"
:
"text"
,
"text"
:
`레시피\n
${
results
[
index
].
recipe
}
`
}
]
...
...
Please
register
or
login
to post a comment