Showing
3 changed files
with
16 additions
and
12 deletions
.gitignore
0 → 100644
1 | +node_modules/ |
1 | var express = require('express'); | 1 | var express = require('express'); |
2 | var app = express(); | 2 | var app = express(); |
3 | const line = require('@line/bot-sdk'); | 3 | const line = require('@line/bot-sdk'); |
4 | +const config = require('./config'); | ||
4 | 5 | ||
5 | 6 | ||
6 | //papago api | 7 | //papago api |
... | @@ -12,19 +13,10 @@ var translate_api_url = 'https://openapi.naver.com/v1/papago/n2mt'; | ... | @@ -12,19 +13,10 @@ var translate_api_url = 'https://openapi.naver.com/v1/papago/n2mt'; |
12 | //언어감지 api_url | 13 | //언어감지 api_url |
13 | var languagedetect_api_url = 'https://openapi.naver.com/v1/papago/detectLangs' | 14 | var languagedetect_api_url = 'https://openapi.naver.com/v1/papago/detectLangs' |
14 | 15 | ||
15 | -// Naver Auth Key | ||
16 | -//새로 발급받은 naver papago api id, pw 입력 | ||
17 | -var client_id = 'xZMx34y7uru1v8lywZ2d'; | ||
18 | -var client_secret = 'p6L7M7WsH9'; | ||
19 | - | ||
20 | -const config = { | ||
21 | - channelAccessToken: 'mnny0MJSezgBXzR9C3Ddcc1Csdb7Y9jkvy2nqV5saOmvR2YOJ1/kj/2M0CNsLA+57B2qDpdUQ7WbCTtIKx/LAJ6Kwfop4tX3up7EM8H9EZK1td6GMbhhCb6wvUFVdb1PcTO4joCv8mspd3ubo8a+gAdB04t89/1O/w1cDnyilFU=', | ||
22 | - channelSecret: 'bde77633a16fc5bfbd532d5990c6170e', | ||
23 | -}; | ||
24 | 16 | ||
25 | 17 | ||
26 | // create LINE SDK client | 18 | // create LINE SDK client |
27 | -const client = new line.Client(config); | 19 | +const client = new line.Client(config.line_config); |
28 | 20 | ||
29 | // create Express app | 21 | // create Express app |
30 | // about Express itself: https://expressjs.com/ | 22 | // about Express itself: https://expressjs.com/ |
... | @@ -52,7 +44,7 @@ function handleEvent(event) { | ... | @@ -52,7 +44,7 @@ function handleEvent(event) { |
52 | var detect_options = { | 44 | var detect_options = { |
53 | url : languagedetect_api_url, | 45 | url : languagedetect_api_url, |
54 | form : {'query': event.message.text}, | 46 | form : {'query': event.message.text}, |
55 | - headers: {'X-Naver-Client-Id': client_id, 'X-Naver-Client-Secret': client_secret} | 47 | + headers: config.naver_header |
56 | }; | 48 | }; |
57 | 49 | ||
58 | //papago 언어 감지 | 50 | //papago 언어 감지 |
... | @@ -77,7 +69,7 @@ function handleEvent(event) { | ... | @@ -77,7 +69,7 @@ function handleEvent(event) { |
77 | url: translate_api_url, | 69 | url: translate_api_url, |
78 | // 한국어(source : ko), 영어(target: en), 카톡에서 받는 메시지(text) | 70 | // 한국어(source : ko), 영어(target: en), 카톡에서 받는 메시지(text) |
79 | form: {'source':source, 'target':target, 'text':event.message.text}, | 71 | form: {'source':source, 'target':target, 'text':event.message.text}, |
80 | - headers: {'X-Naver-Client-Id': client_id, 'X-Naver-Client-Secret': client_secret} | 72 | + headers: config.naver_header |
81 | }; | 73 | }; |
82 | 74 | ||
83 | // Naver Post API | 75 | // Naver Post API | ... | ... |
-
Please register or login to post a comment