은승우

cn

Showing 1 changed file with 2 additions and 0 deletions
......@@ -32,6 +32,7 @@ const client = new line.Client(config);
// register a webhook handler with middleware
// about the middleware, please refer to doc
app.post('/webhook', line.middleware(config), (req, res) => {
console.log("webhook");
Promise
.all(req.body.events.map(handleEvent))
.then((result) => res.json(result))
......@@ -43,6 +44,7 @@ app.post('/webhook', line.middleware(config), (req, res) => {
// event handler
function handleEvent(event) {
console.log("handleevent");
if (event.type !== 'message' || event.message.type !== 'text') {
// ignore non-text-message event
return Promise.resolve(null);
......