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
1
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
최지민
2019-11-23 19:50:52 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
97f50f06dfa7bfb02d4d2546b56040f927707f40
97f50f06
1 parent
85754ad5
search_option1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
app.js
app.js
View file @
97f50f0
...
...
@@ -16,6 +16,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'
;
// 검색 기능 api_url
var
search_api_url
=
'https://openapi.naver.com/v1/search/encyc.json'
;
//polly
const
Polly
=
new
AWS
.
Polly
({
signatureVersion
:
'v4'
,
...
...
@@ -62,8 +66,25 @@ function handleEvent(event) {
// ignore non-text-message event
return
Promise
.
resolve
(
null
);
}
// 검색 기능
else
if
(
event
.
message
.
text
.
substr
(
0
,
4
)
==
"!검색 "
){
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
text_len
=
event
.
message
.
text
;
var
search_options
=
{
url
:
search_api_url
,
form
:
{
'query'
:
event
.
message
.
text
.
substr
(
4
,
text_len
-
4
),
'display'
:
1
},
headers
:
{
'X-Naver-Client-Id'
:
client_id
,
'X-Naver-Client-Secret'
:
client_secret
}
};
request
.
get
(
search_options
,
function
(
error
,
response
,
body
){
console
.
log
(
response
);
})
})
}
// 번역 기능 & 음성 기능
return
new
Promise
(
function
(
resolve
,
reject
)
{
//언어 감지 option
var
detect_options
=
{
url
:
languagedetect_api_url
,
...
...
Please
register
or
login
to post a comment