/**
 *  @file routes.js
 */
const express = require('express'),
  storage = require('node-persist')

const categorize = require('./middlewares').categorize,
  validateGroup = require('./middlewares').validateGroup

let handlers = require('./middlewares').handlers

exports.init = (bot) => {
  storage.initSync()

  const router = express.Router()

  const url = '/bot/:id/:name'

  handlers = handlers.map(handle => handle(bot))

  // handle group messages
  router.post.apply(router, [url, categorize, validateGroup].concat(handlers))

  // handle user messages
  router.post.apply(router, [url].concat(handlers))

  return router
}

/**
 *  @file routes.js
 */
const express = require('express'),
  storage = require('node-persist')

const { validate, isGroup, hasMention, handlers } = require('./middlewares')

exports.init = (bot) => {
  storage.initSync()

  const uri = '/bot/:id/:name'

  const middlewares = handlers.map((init) => init(bot))

  const router = express.Router()

  router.post(uri, validate)

  // group message middlewares
  router.post(uri, isGroup, hasMention, middlewares)

  // private message middlewares
  router.post(uri, middlewares)

  return router
}

Add route and use new filter middlewares
Add route and use new filter middlewares
