Skip to content

Commit

Permalink
pass dev user's
Browse files Browse the repository at this point in the history
  • Loading branch information
AshokShau authored Jul 16, 2023
1 parent 1763120 commit c4cc9c8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Abg/patch/decorators/adminsOnly.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

ANON = TTLCache(maxsize=250, ttl=30)

# ENV
try:
OWNER_ID = int(os.environ.get("OWNER_ID"))
except ValueError:
Expand Down Expand Up @@ -88,8 +89,9 @@ def adminsOnly(
is_bot (bool, optional): If bot can perform the action. Defaults to False.
is_user (bool, optional): If user can perform the action. Defaults to False.
is_both (bool, optional): If both user and bot can perform the action. Defaults to False.
only_owner (bool, optional): If only owner can perform the action. Defaults to False.
no_reply (boot, optional): If should not reply. Defaults to False.
only_owner (bool, optional): If only owner can perform the action. Defaults to False. (It's Chat Owner)
only_dev (bool, optional): if only dev users can perform the operation. Defaults to False.
no_reply (boot, optional): If should not reply. Defaults to False. ( It's perfect when isinstance is `callback` it's give alert and if isinstance is `command` it's give reply)
pass_anon (boot, optional): If the user is an Anonymous Admin, then it bypasses his right check.
"""

Expand Down Expand Up @@ -201,7 +203,7 @@ async def wrapper(
if (
getattr(user.privileges, permissions)
if isinstance(user.privileges, ChatPrivileges)
else False
else False or user.id in DEVS
):
return await func(abg, message, *args, **kwargs)
elif no_reply:
Expand Down Expand Up @@ -233,7 +235,7 @@ async def wrapper(
if (
getattr(user.privileges, permissions)
if isinstance(user.privileges, ChatPrivileges)
else False
else False or user.id in DEVS
):
pass
elif no_reply:
Expand All @@ -258,6 +260,8 @@ async def wrapper(
ChatMemberStatus.OWNER,
]:
return await func(abg, message, *args, **kwargs)
elif user.id in DEVS:
return await func(abg, message, *args, **kwargs)
else:
return await message.reply_text("ʏᴏᴜ ᴀʀᴇ ɴᴏᴛ ᴀᴅᴍɪɴ ʜᴇʀᴇ.")
elif is_both:
Expand All @@ -271,6 +275,8 @@ async def wrapper(
ChatMemberStatus.OWNER,
]:
pass
elif user.id in DEVS:
pass
else:
return await message.reply_text("ʏᴏᴜ ᴀʀᴇ ɴᴏᴛ ᴀᴅᴍɪɴ ʜᴇʀᴇ.")
return await func(abg, message, *args, **kwargs)
Expand Down

0 comments on commit c4cc9c8

Please sign in to comment.