Toggle navigation
Toggle navigation
This project
Loading...
Sign in
장수창
/
COVID19_Information_Chatbot
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
장수창
2020-06-24 22:46:41 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b290cdfa825984fc0c791a92b264098f5e394d61
b290cdfa
1 parent
14db2079
added reply route
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
14 deletions
code/app.js
image/hello.jpg
readMe.md
code/app.js
View file @
b290cdf
...
...
@@ -7,13 +7,13 @@ const yongin_url = 'http://www.yongin.go.kr/health/ictsd/INC_selectIctsdPatntLis
const
TARGET_URL
=
'https://api.line.me/v2/bot/message/reply'
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
TOKEN
=
'
input your token
'
const
NAVER_NEWS_ID
=
'
input your id
'
const
NAVER_NEWS_SECRET
=
'
input your secret
'
const
TOKEN
=
'
YOUR TOKEN
'
const
NAVER_NEWS_ID
=
'
YOUR ID
'
const
NAVER_NEWS_SECRET
=
'
YOUR SECRET
'
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
HTTPS
=
require
(
'https'
);
const
domain
=
"
www.osschatbot2020.tk
"
const
domain
=
"
YOUR DOMAIN
"
const
sslport
=
23023
;
const
bodyParser
=
require
(
'body-parser'
);
var
app
=
express
();
...
...
@@ -45,13 +45,20 @@ app.post('/hook', function (req, res) {
var
sub_nationwide
=
"국내"
;
if
(
isNationWide
.
indexOf
(
sub_nationwide
)
!==
-
1
){
replyNationWide
(
eventObj
);
}
else
if
(
message
.
text
==
"야"
||
message
.
text
==
"도움말"
||
message
.
text
.
indexOf
(
"어떻게"
)
!==
-
1
){
}
else
if
(
message
.
text
==
"야"
||
message
.
text
==
"도움말"
||
message
.
text
.
indexOf
(
"어떻게"
)
!==
-
1
){
console
.
log
(
'[request hello]'
)
replyHello
(
eventObj
);
}
else
if
(
message
.
text
.
indexOf
(
"뉴스"
)
!==
-
1
){
}
else
if
(
message
.
text
.
indexOf
(
"뉴스"
)
!==
-
1
){
console
.
log
(
'[request news]'
)
replyNews
(
eventObj
);
}
else
{
}
else
if
(
message
.
text
.
indexOf
(
"동선"
)
!==
-
1
){
console
.
log
(
'[request route]'
)
replyRoute
(
eventObj
);
}
else
{
console
.
log
(
'[request way]'
)
replyWay
(
eventObj
);
}
...
...
@@ -135,7 +142,7 @@ function replyHello(eventObj) {
},
{
"type"
:
"text"
,
"text"
:
"1. 국내 현황은 '국내'를 타이핑 해주세요."
+
"\n"
+
"\n"
+
"2. 코로나 19 관련 뉴스는 '뉴스'를 타이핑 해주세요."
+
"\n"
+
"\n"
+
"3. 새로운 확진자의 동선이 공개되면 알려드리겠습니다."
"text"
:
"1. 국내 현황은 '국내'를 타이핑 해주세요."
+
"\n"
+
"\n"
+
"2. 코로나 19 관련 뉴스는 '뉴스'를 타이핑 해주세요."
+
"\n"
+
"\n"
+
"3.
용인시 확진자의 동선은 '동선'을 입력해주세요."
+
"\n"
+
"\n"
+
"*
새로운 확진자의 동선이 공개되면 알려드리겠습니다."
},
{
"type"
:
"text"
,
...
...
@@ -192,6 +199,60 @@ function replyWay(eventObj) {
});
}
// reply route yongin
function
replyRoute
(
eventObj
)
{
var
array
=
fs
.
readFileSync
(
'yongin.txt'
).
toString
().
split
(
"\n"
);
real_Text
=
""
for
(
i
in
array
)
{
if
(
array
[
i
]
==
"[인적사항]"
||
array
[
i
]
==
"[환자 현황]"
||
array
[
i
]
==
"[확진자 현황]"
)
{
if
(
i
==
0
)
{
real_Text
+=
array
[
i
];
}
else
{
array
[
i
]
=
'\n'
+
'\n'
+
"[인적사항]"
;
real_Text
+=
array
[
i
];
}
}
else
if
(
array
[
i
].
indexOf
(
"○"
)
!==
-
1
){
array
[
i
]
=
array
[
i
]
+
'\n'
;
real_Text
+=
array
[
i
]
}
else
{
real_Text
+=
array
[
i
]
}
real_Text
+=
'\n'
}
request
.
post
(
{
url
:
TARGET_URL
,
headers
:
{
'Authorization'
:
`Bearer
${
TOKEN
}
`
},
json
:
{
"replyToken"
:
eventObj
.
replyToken
,
"messages"
:[
{
"type"
:
"text"
,
"text"
:
"최근 확진자의 정보입니다. 감사합니다."
},
{
"type"
:
"text"
,
"text"
:
real_Text
},
{
"type"
:
"sticker"
,
"packageId"
:
"11539"
,
"stickerId"
:
"52114110"
}
]
}
},(
error
,
response
,
body
)
=>
{
console
.
log
(
body
)
});
}
// Broadcast yongin
function
broadcast
(){
...
...
image/hello.jpg
0 → 100644
View file @
b290cdf
66.8 KB
readMe.md
View file @
b290cdf
...
...
@@ -36,18 +36,20 @@
## Getting Started
1.
[
LINE
](
https://line.me/ko/
)
설치
<br>
2.
친구 추가
<br
/
>
*
QR code
<br
/
>
<img
src=
"image/qrcode.png"
width=
"200"
height=
"200"
>
<br>
2.
친구 추가
<br>
*
QR code
<br>
하단의 QR code를 통해 친구추가를 할 수 있습니다.
<br>
상단의 QR code를 통해 친구추가를 할 수 있습니다.
<br>
<img
src=
"image/qrcode.png"
width=
"200"
height=
"200"
>
<br>
<br>
*
ID
<br>
아이디를 통해 친구추가를 할 수 있습니다. 아이디는 '@453hriym' 입니다.
<br>
<br>
3.
정보제공동의
<br>
코로나알리미와의 채팅창에서 정보 제공 동의 진행을 해야합니다.
<br>
*
정보제공동의
<br>
코로나알리미와의 채팅창에서 정보 제공 동의를 진행해야 합니다.
<br>
### Installation
...
...
Please
register
or
login
to post a comment