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-05-31 18:18:02 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
edefdddb15b14dad3f018fcd5a07b383b3afa9b9
edefdddb
1 parent
e36ec62e
seperated config
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
12 deletions
.gitignore
app.js
config.js
.gitignore
0 → 100644
View file @
edefddd
node_modules/
app.js
View file @
edefddd
var
express
=
require
(
'express'
);
var
app
=
express
();
const
line
=
require
(
'@line/bot-sdk'
);
const
config
=
require
(
'./config'
);
//papago api
...
...
@@ -12,19 +13,10 @@ var translate_api_url = 'https://openapi.naver.com/v1/papago/n2mt';
//언어감지 api_url
var
languagedetect_api_url
=
'https://openapi.naver.com/v1/papago/detectLangs'
// Naver Auth Key
//새로 발급받은 naver papago api id, pw 입력
var
client_id
=
'xZMx34y7uru1v8lywZ2d'
;
var
client_secret
=
'p6L7M7WsH9'
;
const
config
=
{
channelAccessToken
:
'mnny0MJSezgBXzR9C3Ddcc1Csdb7Y9jkvy2nqV5saOmvR2YOJ1/kj/2M0CNsLA+57B2qDpdUQ7WbCTtIKx/LAJ6Kwfop4tX3up7EM8H9EZK1td6GMbhhCb6wvUFVdb1PcTO4joCv8mspd3ubo8a+gAdB04t89/1O/w1cDnyilFU='
,
channelSecret
:
'bde77633a16fc5bfbd532d5990c6170e'
,
};
// create LINE SDK client
const
client
=
new
line
.
Client
(
config
);
const
client
=
new
line
.
Client
(
config
.
line_config
);
// create Express app
// about Express itself: https://expressjs.com/
...
...
@@ -52,7 +44,7 @@ function handleEvent(event) {
var
detect_options
=
{
url
:
languagedetect_api_url
,
form
:
{
'query'
:
event
.
message
.
text
},
headers
:
{
'X-Naver-Client-Id'
:
client_id
,
'X-Naver-Client-Secret'
:
client_secret
}
headers
:
config
.
naver_header
};
//papago 언어 감지
...
...
@@ -77,7 +69,7 @@ function handleEvent(event) {
url
:
translate_api_url
,
// 한국어(source : ko), 영어(target: en), 카톡에서 받는 메시지(text)
form
:
{
'source'
:
source
,
'target'
:
target
,
'text'
:
event
.
message
.
text
},
headers
:
{
'X-Naver-Client-Id'
:
client_id
,
'X-Naver-Client-Secret'
:
client_secret
}
headers
:
config
.
naver_header
};
// Naver Post API
...
...
config.js
0 → 100644
View file @
edefddd
// Naver Auth Key
export
const
naver_header
=
{
'X-Naver-Client-Id'
:
''
,
'X-Naver-Client-Secret'
:
''
}
// Line config
export
const
line_config
=
{
channelAccessToken
:
''
,
channelSecret
:
''
,
};
Please
register
or
login
to post a comment