Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김대욱
/
trans
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
김대욱
2020-11-29 22:37:55 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9b50d74db3fea1772bc3fce12bc9ac3f023cbb72
9b50d74d
1 parent
96315d42
제발14
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
app.js
app.js
View file @
9b50d74
...
...
@@ -14,6 +14,7 @@ const bodyParser = require('body-parser');
var
app
=
express
();
app
.
use
(
bodyParser
.
json
());
var
cmd
=
""
;
app
.
post
(
'/hook'
,
function
(
req
,
res
)
{
var
eventObj
=
req
.
body
.
events
[
0
];
...
...
@@ -25,17 +26,32 @@ app.post('/hook', function (req, res) {
console
.
log
(
'[request]'
,
req
.
body
);
console
.
log
(
'[request source] '
,
eventObj
.
source
);
console
.
log
(
'[request message]'
,
eventObj
.
message
);
cmd
=
eventObj
.
message
.
text
;
var
cmd
=
eventObj
.
message
.
text
;
res
.
sendStatus
(
200
);
});
app
.
post
(
'/hook'
,
function
(
req
,
res
)
{
var
eventObj
=
req
.
body
.
events
[
0
];
var
source
=
eventObj
.
source
;
var
message
=
eventObj
.
message
;
// request log
console
.
log
(
'======================'
,
new
Date
()
,
'======================'
);
console
.
log
(
'[request]'
,
req
.
body
);
console
.
log
(
'[request source] '
,
eventObj
.
source
);
console
.
log
(
'[request message]'
,
eventObj
.
message
);
if
(
cmd
==
"영어"
){
trans
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
);
trans
en
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
);
}
else
if
(
cmd
==
"프랑스어"
){
trans
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
);
trans
fr
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
);
}
else
if
(
cmd
==
"일본어"
){
trans
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
);
trans
ja
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
);
}
res
.
sendStatus
(
200
);
...
...
Please
register
or
login
to post a comment