mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-31 06:05:22 +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',
|
isAdmin: user && user.status === 'admin',
|
||||||
isMaster: user &&
|
isMaster: user &&
|
||||||
user.id === Number(master) ||
|
user.id === Number(master) ||
|
||||||
|
user.username &&
|
||||||
user.username.toLowerCase() ===
|
user.username.toLowerCase() ===
|
||||||
String(master).replace('@', '').toLowerCase(),
|
String(master).replace('@', '').toLowerCase(),
|
||||||
user: newUser,
|
user: newUser,
|
||||||
|
@@ -11,6 +11,7 @@ const addedToGroupHandler = async (ctx, next) => {
|
|||||||
const msg = ctx.message;
|
const msg = ctx.message;
|
||||||
const { telegram } = ctx;
|
const { telegram } = ctx;
|
||||||
const isMaster = ctx.from.id === Number(master) ||
|
const isMaster = ctx.from.id === Number(master) ||
|
||||||
|
ctx.from.username &&
|
||||||
ctx.from.username.toLowerCase() ===
|
ctx.from.username.toLowerCase() ===
|
||||||
String(master).replace('@', '').toLowerCase();
|
String(master).replace('@', '').toLowerCase();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user