mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-29 21:27:47 +00:00
add fowarded message's user to database
This commit is contained in:
parent
8fe91927c0
commit
0bd4e2244b
@ -28,10 +28,10 @@ const addUserHandler = async (ctx, next) => {
|
|||||||
ctx.state = {
|
ctx.state = {
|
||||||
isAdmin: user && user.status === 'admin',
|
isAdmin: user && user.status === 'admin',
|
||||||
isMaster: user &&
|
isMaster: user &&
|
||||||
(user.id === Number(master) ||
|
(user.id === Number(master) ||
|
||||||
user.username &&
|
user.username &&
|
||||||
user.username.toLowerCase() ===
|
user.username.toLowerCase() ===
|
||||||
String(master).replace('@', '').toLowerCase()),
|
String(master).replace('@', '').toLowerCase()),
|
||||||
user: newUser,
|
user: newUser,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -43,6 +43,13 @@ const addUserHandler = async (ctx, next) => {
|
|||||||
usersToAdd.push(addUser(message.reply_to_message.from));
|
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);
|
await Promise.all(usersToAdd);
|
||||||
|
|
||||||
return next();
|
return next();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user