Telegram Shell. Remote access over Telegram bot API.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

16 lines
458 B

const { path } = require('../util/index.js');
const config = require('../config.js');
const responder = require('./responseHandler.js');
const validate =
(ctx, next) => {
const fromId = path(['update', 'message', 'from', 'id'], ctx);
if(!fromId) return;
return ((fromId === config.masterID)
? Promise.resolve(ctx)
: Promise.reject(ctx))
.then(next)
.catch(responder.fail('Username not authenticated.'));
};
module.exports = validate;