Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이유혁
/
OSS_Project_Chatbot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
이유혁
2019-11-18 18:04:27 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
572236bc6e7400ee4f031518f89357fa031350bf
572236bc
1 parent
0bc301a1
Error fixed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
app.js
app.js
View file @
572236b
...
...
@@ -22,7 +22,7 @@ const line_channel = config.line_channel;
const
client
=
new
line
.
Client
(
line_channel
);
// ELB health checker
app
.
get
(
'/'
,
(
res
)
=>
{
app
.
get
(
'/'
,
(
re
q
,
re
s
)
=>
{
console
.
log
(
'ELB health check'
);
res
.
writeHead
(
200
,
{
"Content-Type"
:
"text/html"
});
res
.
end
();
...
...
@@ -50,17 +50,17 @@ app.post('/webhook', line.middleware(line_channel), (req, res) => {
// 이벤트 타입 검사 이후
// language detector api url 및 client id, secret 을 담은 connector를 반환한다.
const
api_connect
=
(
event
)
=>
{
if
(
event
.
type
!==
'message'
||
event
.
message
.
type
!==
'text'
)
{
// ignore non-text-message event
return
reject
(
new
Error
(
'메세지 혹은, 텍스트가 아닙니다.'
));
}
return
new
Promise
((
resolve
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
event
.
type
!==
'message'
||
event
.
message
.
type
!==
'text'
){
//언어 감지 option
resolve
({
url
:
languagedetect_api_url
,
form
:
{
'query'
:
event
.
message
.
text
},
headers
:
{
'X-Naver-Client-Id'
:
client_id
,
'X-Naver-Client-Secret'
:
client_secret
}
});
resolve
({
url
:
languagedetect_api_url
,
form
:
{
'query'
:
event
.
message
.
text
},
headers
:
{
'X-Naver-Client-Id'
:
client_id
,
'X-Naver-Client-Secret'
:
client_secret
}
});
}
else
{
reject
(
new
Error
(
'메세지 혹은, 텍스트가 아닙니다.'
));
}
})
}
...
...
Please
register
or
login
to post a comment