Browse Source

[validator] fix - app crashing on edited message

master
Muthu Kumar 6 years ago
parent
commit
4d3c0db5c3
  1. 5
      lib/validator.js

5
lib/validator.js

@ -4,8 +4,9 @@ const responder = require('./responseHandler.js');
const validate =
(ctx, next) => {
if(!path(['update', 'message', 'from', 'id'], ctx)) return Promise.reject(ctx);
return ((ctx.update.message.from.id === config.masterID)
const fromId = path(['update', 'message', 'from', 'id'], ctx);
if(!fromId) return;
return ((fromId === config.masterID)
? Promise.resolve(ctx)
: Promise.reject(ctx))
.then(next)

Loading…
Cancel
Save