mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-30 21:55:17 +00:00
check if username exists before using methods
This commit is contained in:
@@ -29,6 +29,7 @@ const addUserHandler = async (ctx, next) => {
|
||||
isAdmin: user && user.status === 'admin',
|
||||
isMaster: user &&
|
||||
user.id === Number(master) ||
|
||||
user.username &&
|
||||
user.username.toLowerCase() ===
|
||||
String(master).replace('@', '').toLowerCase(),
|
||||
user: newUser,
|
||||
|
@@ -11,6 +11,7 @@ const addedToGroupHandler = async (ctx, next) => {
|
||||
const msg = ctx.message;
|
||||
const { telegram } = ctx;
|
||||
const isMaster = ctx.from.id === Number(master) ||
|
||||
ctx.from.username &&
|
||||
ctx.from.username.toLowerCase() ===
|
||||
String(master).replace('@', '').toLowerCase();
|
||||
|
||||
|
Reference in New Issue
Block a user