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-05 14:54:25 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7d0addbca26d9690a04fbff457f2177a6294d59a
7d0addbc
1 parent
27b3898e
Update app.js
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
app.js
app.js
View file @
7d0addb
...
...
@@ -82,11 +82,7 @@ async function handleEvent(event) {
}
else
if
(
event
.
type
==
'message'
&&
event
.
message
.
type
==
'image'
)
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
client
.
getMessageContent
(
event
.
message
.
id
)
.
then
((
stream
)
=>
{
stream
.
on
(
'data'
,
(
chunk
)
=>
{
client
.
replyMessage
(
event
.
replyToken
,
chunk
).
then
(
resolve
).
catch
(
reject
);
/*
fs
.
writeFileSync
(
'./photo/image.png'
,
event
.
message
.
image
)
var
cheerio
=
require
(
'cheerio'
);
var
uriBase
=
'https://koreacentral.api.cognitive.microsoft.com/vision/v2.1/ocr'
;
...
...
@@ -101,11 +97,11 @@ async function handleEvent(event) {
'Content-Type'
:
'application/octet-stream'
,
'Ocp-Apim-Subscription-Key'
:
'979dc5d63344438fa4701c62feebb7dc'
},
body:
chunk
body
:
fs
.
readFileSync
(
'./photo/image.png'
)
};
request
.
post
(
options
,
function
(
error
,
response
,
body
)
{
data
=
body
;
var
text
=
''
;
while
(
data
.
indexOf
(
'text\\'
)
!=-
1
)
{
...
...
@@ -137,10 +133,9 @@ async function handleEvent(event) {
}
client
.
replyMessage
(
event
.
replyToken
,
result
).
then
(
resolve
).
catch
(
reject
);
});
});*/
});
});
})
}
else
if
(
event
.
type
==
'message'
&&
event
.
message
.
type
==
'text'
)
{
...
...
Please
register
or
login
to post a comment