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-06 21:52:21 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
118dc759e99c2bc4fa795b8b76280c7c77766905
118dc759
1 parent
3bf609f7
Update secret key
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
34 deletions
.gitignore
app/app.js
app/package-lock.json
app/package.json
.gitignore
View file @
118dc75
./app/node_mdules
\ No newline at end of file
./app/node_mdules
./app/.env
\ No newline at end of file
...
...
app/app.js
View file @
118dc75
...
...
@@ -11,12 +11,12 @@ app.use(bodyParser.urlencoded({
app
.
use
(
'/api'
,
apiRouter
);
// NAVER SEARCH API
const
CLIENT_ID
=
'fhcqiYQacNyJGILdJBzL'
;
const
CLIENT_SECRET
=
'dmxhW0M_NA'
;
let
userDB
=
new
Array
();
require
(
'dotenv'
).
config
();
const
KAKAO_KEY
=
process
.
env
.
KAKAO_KEY
;
const
CLIENT_ID
=
process
.
env
.
CLIENT_ID
;
const
CLIENT_SECRET
=
process
.
env
.
CLIENT_SECRET
;
const
mbtiDB
=
new
Array
();
mbtiDB
[
0
]
=
[
'ISTP'
,
'https://ifh.cc/g/ac3LWB.jpg'
];
...
...
@@ -893,36 +893,39 @@ apiRouter.post('/result', (req, res) => {
"basicCard"
:
{
"title"
:
"당신의 MBTI는 : "
+
userDB
[
userId
][
4
],
"thumbnail"
:
{
"imageUrl"
:
imageurl
"imageUrl"
:
imageurl
,
"fixedRatio"
:
true
,
"height"
:
100
,
"width"
:
100
},
"buttons"
:
[
{
action
:
"block"
,
label
:
"
자세한 결과
보기"
,
message
:
"
자세한 결과
보기"
,
label
:
"
상세결과
보기"
,
message
:
"
상세결과
보기"
,
blockId
:
"6297bc58ab89e678ee86b33a"
},
{
action
:
"block"
,
label
:
"내 MBTI 특징은?"
,
message
:
"내 MBTI 특징은?"
,
blockId
:
"629ced645ceed96c38548222"
},
{
action
:
"block"
,
label
:
"내 MBTI 관련 영상보기"
,
message
:
"내 MBTI 관련 영상보기"
,
blockId
:
"629b6af95ceed96c38547c19"
label
:
"테스트 다시하기"
,
message
:
"테스트 다시하기"
,
blockId
:
"6297b10d5ceed96c38544a06"
}
]
}
}
],
quickReplies
:
[{
action
:
"block"
,
label
:
"MBTI 테스트 다시하기"
,
message
:
"MBTI 테스트 다시하기"
,
blockId
:
"6297b10d5ceed96c38544a06"
action
:
"block"
,
label
:
"내 MBTI 특징은?"
,
message
:
"내 MBTI 특징은?"
,
blockId
:
"629ced645ceed96c38548222"
},
{
action
:
"block"
,
label
:
"내 MBTI 관련영상 보기"
,
message
:
"내 MBTI 관련영상 보기"
,
blockId
:
"629b6af95ceed96c38547c19"
}
]
}
...
...
@@ -988,7 +991,26 @@ apiRouter.post('/detail', (req, res) => {
text
:
"E와 I의 비율\nE : "
+
(
E
/
(
E
+
I
)
*
100.0
)
+
"%\nI : "
+
(
I
/
(
E
+
I
)
*
100.0
)
+
"%\n\nN와 S의 비율\nN : "
+
(
N
/
(
N
+
S
)
*
100.0
)
+
"%\nS : "
+
(
S
/
(
N
+
S
)
*
100.0
)
+
"%\n\nF와 T의 비율\nF : "
+
(
F
/
(
F
+
T
)
*
100.0
)
+
"%\nT : "
+
(
T
/
(
F
+
T
)
*
100.0
)
+
"%\n\nJ와 P의 비율\nJ : "
+
(
J
/
(
J
+
P
)
*
100.0
)
+
"%\nP : "
+
(
P
/
(
J
+
P
)
*
100.0
)
+
"%"
}
}
]
],
quickReplies
:
[{
action
:
"block"
,
label
:
"테스트 다시하기"
,
message
:
"테스트 다시하기"
,
blockId
:
"6297b10d5ceed96c38544a06"
},
{
action
:
"block"
,
label
:
"내 MBTI 특징은?"
,
message
:
"내 MBTI 특징은?"
,
blockId
:
"629ced645ceed96c38548222"
},
{
action
:
"block"
,
label
:
"내 MBTI 관련영상 보기"
,
message
:
"내 MBTI 관련영상 보기"
,
blockId
:
"629b6af95ceed96c38547c19"
}
]
}
}
res
.
status
(
200
).
send
(
responseBody
);
...
...
@@ -1047,7 +1069,7 @@ apiRouter.post('/mbtivideo', (req, res) => {
url
:
api_url
,
method
:
'GET'
,
headers
:
{
'Authorization'
:
'KakaoAK
45ad937a71c8578ec94f9b5c6c58838b'
'Authorization'
:
'KakaoAK
'
+
KAKAO_KEY
},
encoding
:
'UTF-8'
,
}
...
...
@@ -1096,14 +1118,14 @@ apiRouter.post('/mbtivideo', (req, res) => {
],
quickReplies
:
[{
action
:
"block"
,
label
:
"
MBTI
테스트 다시하기"
,
message
:
"
MBTI
테스트 다시하기"
,
label
:
"테스트 다시하기"
,
message
:
"테스트 다시하기"
,
blockId
:
"6297b10d5ceed96c38544a06"
},
{
action
:
"block"
,
label
:
"
자세한 결과
보기"
,
message
:
"
자세한 결과
보기"
,
label
:
"
상세결과
보기"
,
message
:
"
상세결과
보기"
,
blockId
:
"6297bc58ab89e678ee86b33a"
}
]
...
...
@@ -1128,7 +1150,7 @@ apiRouter.post('/searchMBTI', (req, res) => {
var
options
=
{
url
:
api_url
,
headers
:
{
'X-Naver-Client-Id'
:
CLIENT_ID
,
'X-Naver-Client-Secret'
:
CLIENT_SECRET
}
headers
:
{
'X-Naver-Client-Id'
:
CLIENT_ID
,
'X-Naver-Client-Secret'
:
CLIENT_SECRET
}
};
request
.
get
(
options
,
function
(
error
,
response
,
body
)
{
...
...
@@ -1172,20 +1194,20 @@ apiRouter.post('/searchMBTI', (req, res) => {
],
quickReplies
:
[{
action
:
"block"
,
label
:
"
MBTI
테스트 다시하기"
,
message
:
"
MBTI
테스트 다시하기"
,
label
:
"테스트 다시하기"
,
message
:
"테스트 다시하기"
,
blockId
:
"6297b10d5ceed96c38544a06"
},
{
action
:
"block"
,
label
:
"
자세한 결과
보기"
,
message
:
"
자세한 결과
보기"
,
label
:
"
상세결과
보기"
,
message
:
"
상세결과
보기"
,
blockId
:
"6297bc58ab89e678ee86b33a"
},
{
action
:
"block"
,
label
:
"내 MBTI 관련
영상
보기"
,
message
:
"내 MBTI 관련
영상
보기"
,
label
:
"내 MBTI 관련
영상
보기"
,
message
:
"내 MBTI 관련
영상
보기"
,
blockId
:
"629b6af95ceed96c38547c19"
}
]
...
...
app/package-lock.json
View file @
118dc75
...
...
@@ -5,6 +5,7 @@
"packages"
:
{
""
:
{
"dependencies"
:
{
"dotenv"
:
"^16.0.1"
,
"express"
:
"^4.18.1"
,
"request"
:
"^2.88.2"
}
...
...
@@ -223,6 +224,14 @@
"npm"
:
"1.2.8000 || >= 1.4.16"
}
},
"node_modules/dotenv"
:
{
"version"
:
"16.0.1"
,
"resolved"
:
"https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz"
,
"integrity"
:
"sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ=="
,
"engines"
:
{
"node"
:
">=12"
}
},
"node_modules/ecc-jsbn"
:
{
"version"
:
"0.1.2"
,
"resolved"
:
"https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz"
,
...
...
@@ -1137,6 +1146,11 @@
"resolved"
:
"https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz"
,
"integrity"
:
"sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg=="
},
"dotenv"
:
{
"version"
:
"16.0.1"
,
"resolved"
:
"https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz"
,
"integrity"
:
"sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ=="
},
"ecc-jsbn"
:
{
"version"
:
"0.1.2"
,
"resolved"
:
"https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz"
,
...
...
app/package.json
View file @
118dc75
{
"dependencies"
:
{
"dotenv"
:
"^16.0.1"
,
"express"
:
"^4.18.1"
,
"request"
:
"^2.88.2"
}
...
...
Please
register
or
login
to post a comment