Showing
1 changed file
with
11 additions
and
2 deletions
... | @@ -82,11 +82,19 @@ app.post('/webhook', line.middleware(config), (req, res) => { | ... | @@ -82,11 +82,19 @@ app.post('/webhook', line.middleware(config), (req, res) => { |
82 | // event handler | 82 | // event handler |
83 | function handleEvent(event) { | 83 | function handleEvent(event) { |
84 | console.log(event.message); | 84 | console.log(event.message); |
85 | - if (event.type !== 'message' || event.message.type !== 'text') { | 85 | + if (event.type !== 'message'&& event.message.type !== 'text') { |
86 | // ignore non-text-message event | 86 | // ignore non-text-message event |
87 | return Promise.resolve(null); | 87 | return Promise.resolve(null); |
88 | } | 88 | } |
89 | - return new Promise(function(resolve, reject) { | 89 | + if (event.type == 'message'&& event.message.type == 'image') { |
90 | + return new Promise((resolve,reject)=>{ | ||
91 | + var upload = multer({ dest: 'photo/' }) | ||
92 | + upload.single(event.message.image); | ||
93 | + | ||
94 | + }) | ||
95 | + } | ||
96 | + if (event.type == 'message'&& event.message.type == 'text') { | ||
97 | + return new Promise(function(resolve, reject) { | ||
90 | //언어 감지 option | 98 | //언어 감지 option |
91 | var detect_options = { | 99 | var detect_options = { |
92 | url : languagedetect_api_url, | 100 | url : languagedetect_api_url, |
... | @@ -152,6 +160,7 @@ function handleEvent(event) { | ... | @@ -152,6 +160,7 @@ function handleEvent(event) { |
152 | 160 | ||
153 | }); | 161 | }); |
154 | } | 162 | } |
163 | +} | ||
155 | app.get('/',(req,res)=>{ | 164 | app.get('/',(req,res)=>{ |
156 | res.send("hellow"); | 165 | res.send("hellow"); |
157 | }) | 166 | }) | ... | ... |
-
Please register or login to post a comment