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 22:08:52 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
97c4f608db70a276d5449822b029d6ed6a3eb126
97c4f608
1 parent
211e9a23
Update app.js
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
app.js
app.js
View file @
97c4f60
var
createServer
=
require
(
"auto-sni"
);
var
express
=
require
(
"express"
);
var
app
=
express
();
const
line
=
require
(
'@line/bot-sdk'
);
...
...
@@ -17,6 +17,7 @@ const lex = require('greenlock-express').create({
opts
.
agreeTos
=
true
;
}
cb
(
null
,
{
options
:
opts
,
certs
});
},
renewWithin
:
81
*
24
*
60
*
60
*
1000
,
renewBy
:
80
*
24
*
60
*
60
*
1000
,
...
...
@@ -80,7 +81,6 @@ function handleEvent(event) {
};
//papago 언어 감지
request
.
post
(
detect_options
,
async
(
error
,
response
,
body
)
=>
{
console
.
log
(
response
.
statusCode
);
if
(
!
error
&&
response
.
statusCode
==
200
){
var
detect_body
=
JSON
.
parse
(
response
.
body
);
var
source
=
''
;
...
...
@@ -112,16 +112,17 @@ function handleEvent(event) {
// Message 잘 찍히는지 확인
result
.
text
=
objBody
.
message
.
result
.
translatedText
;
console
.
log
(
result
);
console
.
log
(
"source: "
+
objBody
);
console
.
log
(
"result: "
+
result
.
text
);
//번역된 문장 보내기
client
.
replyMessage
(
event
.
replyToken
,
result
.
text
).
then
(
resolve
);
client
.
replyMessage
(
event
.
replyToken
,
result
).
then
(
resolve
).
catch
(
reject
);
}
});
}
// 메시지의 언어가 영어 또는 한국어가 아닐 경우
else
{
result
.
text
=
'언어를 감지할 수 없습니다. \n 번역 언어는 한글 또는 영어만 가능합니다.'
;
client
.
replyMessage
(
event
.
replyToken
,
result
).
then
(
resolve
);
client
.
replyMessage
(
event
.
replyToken
,
result
).
then
(
resolve
)
.
catch
(
reject
)
;
}
}
...
...
Please
register
or
login
to post a comment