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
Minkyung Ko
2022-06-05 01:04:13 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1c0930068554a065ca6b805d2b52a820f9500797
1c093006
1 parent
13e95c15
Add mbti video search
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
0 deletions
app/app.js
app/app.js
View file @
1c09300
...
...
@@ -892,6 +892,12 @@ apiRouter.post('/result', (req, res) => {
label
:
"내 MBTI 특징은?"
,
message
:
"내 MBTI 특징은?"
,
blockId
:
"6299ef8aab89e678ee86da0d"
},
{
action
:
"block"
,
label
:
"내 MBTI 관련 영상 보러 가기"
,
message
:
"내 MBTI 관련 영상 보러 가기"
,
blockId
:
"629b6af95ceed96c38547c19"
}
]
}
...
...
@@ -1055,6 +1061,88 @@ apiRouter.post('/searchmbti', (req, res) => {
});
apiRouter
.
post
(
'/mbtivideo'
,
(
req
,
res
)
=>
{
var
userId
=
req
.
body
.
userRequest
.
user
.
id
;
var
userMbti
=
userDB
[
userId
][
4
];
var
api_url
=
'https://dapi.kakao.com/v2/search/vclip?query='
+
userMbti
;
var
request
=
require
(
'request'
);
console
.
log
(
api_url
);
var
options
=
{
url
:
api_url
,
method
:
'GET'
,
headers
:
{
'Authorization'
:
'KakaoAK 45ad937a71c8578ec94f9b5c6c58838b'
},
encoding
:
'UTF-8'
,
}
request
(
options
,
function
(
error
,
response
,
body
)
{
if
(
!
error
&&
response
.
statusCode
==
200
)
{
var
result
=
JSON
.
parse
(
body
);
console
.
log
(
result
.
documents
);
const
responseBody
=
{
version
:
"2.0"
,
template
:
{
outputs
:
[
{
"listCard"
:
{
"header"
:
{
"title"
:
userMbti
+
" 관련 영상입니다."
},
"items"
:
[
{
"title"
:
result
.
documents
[
0
].
title
,
"description"
:
result
.
documents
[
0
].
author
,
"imageUrl"
:
result
.
documents
[
0
].
thumbnail
,
"link"
:{
"web"
:
result
.
documents
[
0
].
url
}
},
{
"title"
:
result
.
documents
[
1
].
title
,
"description"
:
result
.
documents
[
1
].
author
,
"imageUrl"
:
result
.
documents
[
1
].
thumbnail
,
"link"
:{
"web"
:
result
.
documents
[
1
].
url
}
},
{
"title"
:
result
.
documents
[
2
].
title
,
"description"
:
result
.
documents
[
2
].
author
,
"imageUrl"
:
result
.
documents
[
2
].
thumbnail
,
"link"
:{
"web"
:
result
.
documents
[
2
].
url
}
}
]
}
}
],
quickReplies
:
[{
action
:
"block"
,
label
:
"MBTI 테스트 다시하기"
,
message
:
"MBTI 테스트 다시하기"
,
blockId
:
"6297b10d5ceed96c38544a06"
},
{
action
:
"block"
,
label
:
"자세한 결과 보기"
,
message
:
"자세한 결과 보기"
,
blockId
:
"6297bc58ab89e678ee86b33a"
}
]
}
}
res
.
status
(
200
).
send
(
responseBody
);
}
else
{
res
.
status
(
response
.
statusCode
).
end
();
console
.
log
(
'error = '
+
response
.
statusCode
);
}
});
});
app
.
listen
((
process
.
env
.
PORT
||
3000
),
function
()
{
console
.
log
(
'Example skill server listening on port 3000!'
);
});
\ No newline at end of file
...
...
Please
register
or
login
to post a comment