Showing
1 changed file
with
24 additions
and
1 deletions
... | @@ -33,4 +33,27 @@ function transMsg(replyMsg){ | ... | @@ -33,4 +33,27 @@ function transMsg(replyMsg){ |
33 | console.log(transMessage); | 33 | console.log(transMessage); |
34 | } | 34 | } |
35 | }); | 35 | }); |
36 | - } | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
36 | + } | ||
37 | + | ||
38 | +var replyMsg = "선수, 시즌, 순위, 리그, 손흥민, 네이마르, 1등" | ||
39 | + | ||
40 | +function transMsg_toEn(replyMsg){ | ||
41 | + var language = "en"; | ||
42 | + | ||
43 | + request.post( | ||
44 | + { | ||
45 | + url: PAPAGO_URL, | ||
46 | + headers: { | ||
47 | + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', | ||
48 | + 'X-Naver-Client-Id': `${PAPAGO_ID}`, | ||
49 | + 'X-Naver-Client-Secret': `${PAPAGO_SECRET}` | ||
50 | + }, | ||
51 | + body: 'source=ko&target=' + language + '&text=' + replyMsg, | ||
52 | + json:true | ||
53 | + },(error, response, body) => { | ||
54 | + if(!error && response.statusCode == 200) { | ||
55 | + let transMessage = body.message.result.translatedText; | ||
56 | + console.log(transMessage); | ||
57 | + } | ||
58 | + }); | ||
59 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment