Toggle navigation
Toggle navigation
This project
Loading...
Sign in
윤성배
/
chatbot_for_PsychologicalTest
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Ubuntu
2020-12-10 13:02:45 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4eaa7330b4adb9aa618efabdceecfffe1761032e
4eaa7330
1 parent
327fbaf6
terminate is updated and apikey, token are deleted
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
app.js
app.js
View file @
4eaa733
var
express
=
require
(
'express'
);
const
request
=
require
(
'request'
);
const
TARGET_URL
=
'https://api.line.me/v2/bot/message/reply'
const
TOKEN
=
'
femdVKgBP5AnhQ8aW6Q7I/wQeC2sPoTovRQiaVSMXnbGztImhOtK7q303LV3OFdua9c618XN6cyWVeh5CqL/ItLavtPYbO64FAX8GJZwcS2HpPPFRBmlqZbchKlKAB6NSb1+QZKzOPwMurZpv7wBwQdB04t89/1O/w1cDnyilFU=
'
const
Question_URL
=
'https://inspct.career.go.kr/openapi/test/questions?apikey=
8f65744f11f9b7e8fc2b7c28617e9d09
&q=6'
const
TOKEN
=
''
const
Question_URL
=
'https://inspct.career.go.kr/openapi/test/questions?apikey=&q=6'
const
Result_URL
=
'https://inspct.career.go.kr/openapi/test/report'
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
...
...
@@ -66,7 +66,7 @@ app.post('/hook', function (req, res) {
request
.
post
({
url
:
Result_URL
,
json
:{
"apikey"
:
"
8f65744f11f9b7e8fc2b7c28617e9d09
"
,
"apikey"
:
""
,
"qestrnSeq"
:
"6"
,
"trgetSe"
:
"100208"
,
"gender"
:
"100323"
,
...
...
@@ -97,7 +97,7 @@ app.post('/hook', function (req, res) {
});
});
}
else
{
}
else
if
(
i
>
0
)
{
request
.
get
({
url
:
Question_URL
},
function
(
err
,
res
,
body
){
...
...
@@ -129,6 +129,24 @@ app.post('/hook', function (req, res) {
});
});
}
}
else
if
(
message
.
text
==
"종료"
)
{
request
.
post
({
url
:
TARGET_URL
,
headers
:
{
'Authorization'
:
`Bearer
${
TOKEN
}
`
},
json
:
{
"replyToken"
:
eventObj
.
replyToken
,
"messages"
:
{
"type"
:
"text"
,
"text"
:
"검사를 종료합니다"
}
}
},(
error
,
response
,
body
)
=>
{
console
.
log
(
"terminated"
);
i
=-
1
;
});
}
res
.
sendStatus
(
200
);
});
...
...
Please
register
or
login
to post a comment