diff --git a/handlers/messages/addUser.js b/handlers/messages/addUser.js index 1f13d6e..1998aa9 100644 --- a/handlers/messages/addUser.js +++ b/handlers/messages/addUser.js @@ -28,10 +28,10 @@ const addUserHandler = async (ctx, next) => { ctx.state = { isAdmin: user && user.status === 'admin', isMaster: user && - (user.id === Number(master) || + (user.id === Number(master) || user.username && user.username.toLowerCase() === - String(master).replace('@', '').toLowerCase()), + String(master).replace('@', '').toLowerCase()), user: newUser, }; @@ -43,6 +43,13 @@ const addUserHandler = async (ctx, next) => { usersToAdd.push(addUser(message.reply_to_message.from)); } + if ( + message.forward_from && + !await isUser(message.forward_from) + ) { + usersToAdd.push(addUser(message.forward_from)); + } + await Promise.all(usersToAdd); return next();