Toggle navigation
Toggle navigation
This project
Loading...
Sign in
방승일
/
find_mbti_bot
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-02 06:31:25 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
21e9c1c59c33ab5d492c6e36207521e823efd7b7
21e9c1c5
1 parent
fd31731c
Add question1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
159 deletions
app/app.js
app/app.js
View file @
21e9c1c
...
...
@@ -45,7 +45,7 @@ apiRouter.post('/question1', (req, res) => {
var
userId
=
req
.
body
.
userRequest
.
user
.
id
;
var
mesg
=
req
.
body
.
userRequest
;
console
.
log
(
'[q1:user message] '
,
mesg
);
userDB
[
userId
]
=
''
;
userDB
[
userId
]
=
[
''
,
''
,
''
,
''
,
''
]
;
console
.
log
(
userDB
[
userId
]);
const
responseBody
=
{
version
:
"2.0"
,
...
...
@@ -53,7 +53,7 @@ apiRouter.post('/question1', (req, res) => {
outputs
:
[
{
simpleText
:
{
text
:
'
사람들과 어울리는 것을 좋아하시나요?
'
text
:
'
금방 새로운 직장 사람들과 어울리기 시작합니다.
'
}
}
],
...
...
@@ -62,13 +62,13 @@ apiRouter.post('/question1', (req, res) => {
action
:
"block"
,
label
:
"네"
,
message
:
"네"
,
blockId
:
"62
8e8cb07bd2fd433357f878
"
blockId
:
"62
97b11ae7a0253c7662ccea
"
},
{
action
:
"block"
,
label
:
"아니오"
,
message
:
"아니오"
,
blockId
:
"62
8e8cb07bd2fd433357f878
"
blockId
:
"62
97b11ae7a0253c7662ccea
"
}
]
}
...
...
@@ -76,161 +76,6 @@ apiRouter.post('/question1', (req, res) => {
res
.
status
(
200
).
send
(
responseBody
);
});
apiRouter
.
post
(
'/question2'
,
(
req
,
res
)
=>
{
var
userId
=
req
.
body
.
userRequest
.
user
.
id
;
var
mesg
=
req
.
body
.
userRequest
.
utterance
;
console
.
log
(
'[q2:user message] '
,
mesg
);
var
mbti
=
''
;
if
(
mesg
==
"네"
)
{
mbti
=
'E'
;
}
else
if
(
mesg
==
"아니오"
)
{
mbti
=
'I'
;
}
userDB
[
userId
]
+=
mbti
;
console
.
log
(
userDB
[
userId
]);
const
responseBody
=
{
version
:
"2.0"
,
template
:
{
outputs
:
[
{
simpleText
:
{
text
:
'평소 깻잎논쟁에 1시간 이상을 생각해봤다.'
}
}
],
quickReplies
:
[
{
action
:
"block"
,
label
:
"네"
,
message
:
"네"
,
blockId
:
"628d239d93b31d5b60ab6c29"
},
{
action
:
"block"
,
label
:
"아니오"
,
message
:
"아니오"
,
blockId
:
"628d239d93b31d5b60ab6c29"
}
]
}
}
res
.
status
(
200
).
send
(
responseBody
);
});
apiRouter
.
post
(
'/question3'
,
function
(
req
,
res
)
{
var
userId
=
req
.
body
.
userRequest
.
user
.
id
;
var
mesg
=
req
.
body
.
userRequest
.
utterance
;
console
.
log
(
'[q3:user message] '
,
mesg
);
var
mbti
=
''
;
if
(
mesg
==
'네'
)
{
mbti
=
'N'
;
}
else
if
(
mesg
==
'아니오'
)
{
mbti
=
'S'
;
}
userDB
[
userId
]
+=
mbti
;
console
.
log
(
userDB
[
userId
]);
const
responseBody
=
{
version
:
"2.0"
,
template
:
{
outputs
:
[
{
"simpleText"
:
{
"text"
:
"다음과 같은 상황에서 어떻게 대답하겠습니까?\n 친구: 나 기분 안 좋아서 옷 샀어"
}
}
],
quickReplies
:
[
{
action
:
"block"
,
label
:
"왜 기분 안 좋아?"
,
message
:
"왜 기분 안 좋아?"
,
blockId
:
"6290630451c40d32c6d8e71f"
},
{
action
:
"block"
,
label
:
"무슨 옷 샀어?"
,
message
:
"무슨 옷 샀어?"
,
blockId
:
"6290630451c40d32c6d8e71f"
}
]
}
};
res
.
status
(
200
).
send
(
responseBody
);
});
apiRouter
.
post
(
'/question4'
,
(
req
,
res
)
=>
{
var
userId
=
req
.
body
.
userRequest
.
user
.
id
;
var
mesg
=
req
.
body
.
userRequest
.
utterance
;
console
.
log
(
'[q4:user message] '
,
mesg
);
var
mbti
=
''
;
if
(
mesg
==
"왜 기분 안 좋아?"
)
{
mbti
=
'F'
;
}
else
if
(
mesg
==
"무슨 옷 샀어?"
)
{
mbti
=
'T'
;
}
userDB
[
userId
]
+=
mbti
;
console
.
log
(
userDB
[
userId
]);
const
responseBody
=
{
version
:
"2.0"
,
template
:
{
outputs
:
[
{
simpleText
:
{
text
:
"그날 할 일에 대해 계획을 미리 세우시나요?"
}
}
],
quickReplies
:
[
{
action
:
"block"
,
label
:
"네"
,
message
:
"네"
,
blockId
:
"6293885b7bd2fd4333583df0"
},
{
action
:
"block"
,
label
:
"아니오"
,
message
:
"아니오"
,
blockId
:
"6293885b7bd2fd4333583df0"
}
]
}
}
res
.
status
(
200
).
send
(
responseBody
);
});
apiRouter
.
post
(
'/result'
,
(
req
,
res
)
=>
{
var
userId
=
req
.
body
.
userRequest
.
user
.
id
;
var
mesg
=
req
.
body
.
userRequest
.
utterance
;
console
.
log
(
'[result:user message] '
,
mesg
);
var
mbti
=
''
;
if
(
mesg
==
"네"
)
{
mbti
=
'J'
;
}
else
if
(
mesg
==
"아니오"
)
{
mbti
=
'P'
;
}
userDB
[
userId
]
+=
mbti
;
console
.
log
(
userDB
[
userId
]);
const
responseBody
=
{
version
:
"2.0"
,
template
:
{
outputs
:
[
{
simpleText
:
{
text
:
"당신의 MBTI는 : "
+
userDB
[
userId
]
}
}
],
quickReplies
:
[{
action
:
"block"
,
label
:
"MBTI 테스트 다시하기"
,
message
:
"MBTI 테스트 다시하기"
,
blockId
:
"628b8005055a574d7df54466"
}]
}
}
res
.
status
(
200
).
send
(
responseBody
);
});
app
.
listen
((
process
.
env
.
PORT
||
3000
),
function
()
{
console
.
log
(
'Example skill server listening on port 3000!'
);
...
...
Please
register
or
login
to post a comment