Toggle navigation
Toggle navigation
This project
Loading...
Sign in
은승우
/
LINEBOT
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
은승우
2019-12-02 14:21:27 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
509d54fccd9862610231c1d8604756dfe7d12f61
509d54fc
1 parent
270d8c81
Update app.js
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
app.js
app.js
View file @
509d54f
...
...
@@ -55,14 +55,13 @@ const client = new line.Client(config);
// about the middleware, please refer to doc
app
.
post
(
'/webhook'
,
line
.
middleware
(
config
),
(
req
,
res
)
=>
{
console
.
log
(
res
.
statusCode
);
console
.
log
(
"webhook"
);
Promise
.
all
(
req
.
body
.
events
.
map
(
handleEvent
))
.
then
((
result
)
=>
res
.
json
(
result
))
});
// event handler
function
handleEvent
(
event
)
{
console
.
log
(
"handleevent"
);
console
.
log
(
event
.
message
)
if
(
event
.
type
!==
'message'
||
event
.
message
.
type
!==
'text'
)
{
// ignore non-text-message event
return
Promise
.
resolve
(
null
);
...
...
@@ -74,7 +73,6 @@ function handleEvent(event) {
form
:
{
'query'
:
event
.
message
.
text
},
headers
:
{
'X-Naver-Client-Id'
:
client_id
,
'X-Naver-Client-Secret'
:
client_secret
}
};
console
.
log
(
"1"
);
//papago 언어 감지
request
.
post
(
detect_options
,
function
(
error
,
response
,
body
){
console
.
log
(
response
.
statusCode
);
...
...
@@ -122,6 +120,9 @@ function handleEvent(event) {
}
}
else
{
console
.
log
(
"status code is not 200"
);
}
});
...
...
Please
register
or
login
to post a comment