Toggle navigation
Toggle navigation
This project
Loading...
Sign in
오규림
/
Personal_color_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
suhyunpark
2021-06-09 11:45:14 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
620156bdd35fade0656b90b6dd2b8d6485224e37
620156bd
1 parent
677631fb
Update result
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
44 deletions
app.js
app.js
View file @
620156b
var
express
=
require
(
'express'
);
const
request
=
require
(
'request'
);
const
TARGET_URL
=
'https://api.line.me/v2/bot/message/reply'
const
TARGET_URL
=
'https://api.line.me/v2/bot/message/reply'
;
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
HTTPS
=
require
(
'https'
);
const
sslport
=
23023
;
const
MULTI_TARGET_URL
=
'https://api.line.me/v2/bot/message/multicast'
const
BROAD_TARGET_URL
=
'https://api.line.me/v2/bot/message/broadcast'
const
MULTI_TARGET_URL
=
'https://api.line.me/v2/bot/message/multicast'
;
const
BROAD_TARGET_URL
=
'https://api.line.me/v2/bot/message/broadcast'
;
const
info
=
require
(
'./info.js'
);
var
spring
=
0
var
summer
=
0
var
fall
=
0
var
winter
=
0
var
spring
=
0
;
var
summer
=
0
;
var
fall
=
0
;
var
winter
=
0
;
var
warm
=
0
var
cool
=
0
var
warm
=
0
;
var
cool
=
0
;
var
warm_index
=
0
var
cool_index
=
0
var
skinIndex
=
0
var
warm_index
=
0
;
var
cool_index
=
0
;
var
skinIndex
=
0
;
var
i
=
0
var
j
=
-
9
var
i
=
0
;
var
j
=
-
9
;
var
QuestionCount
=
9
var
QuestionCount
=
9
;
var
QuestionIndex
=
0
var
count
=
16
=
0
;
var
count
=
16
;
var
WarmOrCool
=
[
warm
,
cool
];
var
season_color
=
[
spring
,
summer
,
fall
,
winter
]
var
season_color
=
[
spring
,
summer
,
fall
,
winter
]
;
var
Questions
=
[
'나의 피부색은 (1)노란기 (2)붉은기가 돈다.'
,
...
...
@@ -42,7 +42,7 @@ var Questions = [
'나는 (1)아이보리 (2)새하얀 화이트가 더 잘 어울린다.'
,
'나는 (1)브라운/카키 (2)핑크/블루 계열의 옷이 더 잘어울린다.'
,
'햇빛에 노출되었을 경우 (1)갈색으로 탄다 (2)붉게 그을린다.'
,
]
]
;
var
warm_files
=
[
'https://personal-color-chatbot.s3.amazonaws.com/warm_carmel.png'
,
...
...
@@ -52,7 +52,7 @@ var warm_files = [
'https://personal-color-chatbot.s3.amazonaws.com/warm_purple.png'
,
'https://personal-color-chatbot.s3.amazonaws.com/warm_softgreen.png'
,
'https://personal-color-chatbot.s3.amazonaws.com/warm_yellow.jpg'
,
]
]
;
var
cool_files
=
[
'https://personal-color-chatbot.s3.amazonaws.com/cool_blue.png'
,
...
...
@@ -62,7 +62,7 @@ var cool_files = [
'https://personal-color-chatbot.s3.amazonaws.com/cool_navy.png'
,
'https://personal-color-chatbot.s3.amazonaws.com/cool_pink.png'
,
'https://personal-color-chatbot.s3.amazonaws.com/cool_yellow.png'
,
]
]
;
const
bodyParser
=
require
(
'body-parser'
);
...
...
@@ -91,7 +91,7 @@ request.post(
]
}
},
(
error
,
response
,
body
)
=>
{
console
.
log
(
body
)
console
.
log
(
body
)
;
});
...
...
@@ -104,10 +104,10 @@ app.post('/hook', function (req, res) {
var
source
=
eventObj
.
source
;
var
message
=
eventObj
.
message
;
TestSkinType
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
)
Color_Test
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
)
TestSkinType
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
)
;
Color_Test
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
)
;
if
(
YourSkinTypeIs
(
warm
,
cool
)
==
0
)
Get_warmColor
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
);
if
(
YourSkinTypeIs
(
warm
,
cool
)
==
=
0
)
Get_warmColor
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
);
else
if
(
YourSkinTypeIs
(
warm
,
cool
)
==
1
)
Get_coolColor
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
);
res
.
sendStatus
(
200
);
...
...
@@ -132,7 +132,7 @@ function TestSkinType(replyToken, message) {
],
}
},
(
error
,
response
,
body
)
=>
{
console
.
log
(
body
)
console
.
log
(
body
)
;
});
}
}
...
...
@@ -158,13 +158,13 @@ function Color_Test(replyToken, message) {
],
}
},
(
error
,
response
,
body
)
=>
{
console
.
log
(
body
)
console
.
log
(
body
)
;
});
}
if
(
QuestionCount
<=
0
)
{
if
(
YourSkinTypeIs
(
warm
,
cool
)
==
0
)
{
if
(
YourSkinTypeIs
(
warm
,
cool
)
==
=
0
)
{
request
.
post
(
{
url
:
TARGET_URL
,
...
...
@@ -182,7 +182,7 @@ function Color_Test(replyToken, message) {
],
}
},
(
error
,
response
,
body
)
=>
{
console
.
log
(
body
)
console
.
log
(
body
)
;
});
}
else
if
(
YourSkinTypeIs
(
warm
,
cool
)
==
1
)
{
...
...
@@ -203,7 +203,7 @@ function Color_Test(replyToken, message) {
],
}
},
(
error
,
response
,
body
)
=>
{
console
.
log
(
body
)
console
.
log
(
body
)
;
});
}
...
...
@@ -211,7 +211,7 @@ function Color_Test(replyToken, message) {
}
if
(
count
==
0
)
{
if
(
count
==
=
0
)
{
request
.
post
(
{
url
:
TARGET_URL
,
...
...
@@ -228,30 +228,30 @@ function Color_Test(replyToken, message) {
],
}
},
(
error
,
response
,
body
)
=>
{
console
.
log
(
body
)
console
.
log
(
body
)
;
});
}
if
(
message
==
"1"
)
{
warm
+=
1
warm
+=
1
;
}
else
if
(
message
==
"2"
)
{
cool
+=
1
cool
+=
1
;
}
if
(
QuestionCount
<
0
)
{
if
(
message
==
'1'
&&
YourSkinTypeIs
(
warm
,
cool
)
==
0
)
spring
+=
1
else
if
(
message
==
'2'
&&
YourSkinTypeIs
(
warm
,
cool
)
==
0
)
fall
+=
1
else
if
(
message
==
'1'
&&
YourSkinTypeIs
(
warm
,
cool
)
==
1
)
summer
+=
1
else
if
(
message
==
'2'
&&
YourSkinTypeIs
(
warm
,
cool
)
==
1
)
winter
+=
1
if
(
message
==
'1'
&&
YourSkinTypeIs
(
warm
,
cool
)
==
=
0
)
spring
+=
1
;
else
if
(
message
==
'2'
&&
YourSkinTypeIs
(
warm
,
cool
)
==
=
0
)
fall
+=
1
;
else
if
(
message
==
'1'
&&
YourSkinTypeIs
(
warm
,
cool
)
==
1
)
summer
+=
1
;
else
if
(
message
==
'2'
&&
YourSkinTypeIs
(
warm
,
cool
)
==
1
)
winter
+=
1
;
}
i
+=
1
j
+=
1
i
+=
1
;
j
+=
1
;
QuestionCount
-=
1
;
count
-=
1
count
-=
1
;
YourSkinTypeIs
(
warm
,
cool
);
if
(
YourSkinTypeIs
(
warm
,
cool
)
==
0
)
{
if
(
YourSkinTypeIs
(
warm
,
cool
)
==
=
0
)
{
YourWarmColorIs
(
spring
,
fall
);
}
else
YourCoolColorIs
(
summer
,
winter
);
...
...
@@ -270,8 +270,8 @@ function YourSkinTypeIs(warm, cool) {
function
YourWarmColorIs
(
spring
,
fall
)
{
if
(
spring
>
fall
)
warm_index
=
0
else
warm_index
=
1
if
(
spring
>
fall
)
warm_index
=
0
;
else
warm_index
=
1
;
return
warm_index
;
}
...
...
Please
register
or
login
to post a comment