slack-robot icon indicating copy to clipboard operation
slack-robot copied to clipboard

Missing docs for ACL

Open pveyes opened this issue 9 years ago • 0 comments

ACL behaves similar to middleware in express

robot.listen('message', function (req, res) {
  // do something
  return res.text('Yo').send()
})
.acl(function (req, res, next) {
  // check for condition
  if (req.channel.type !== 'dm') {
    return next();
  }

  return res.text('sorry, no dm allowed').send();
});

also support multiple acls

robot.listen('message', handlerCallback).acl(noDM, fromAdmin);

function noDM(req, res, next) {
  // first condition
  next();
};

function fromAdmin(req, res, next) {
  // second condition
  next();
};

pveyes avatar Jan 20 '16 00:01 pveyes