Skip to content

Commit

Permalink
fix: false positive role exception
Browse files Browse the repository at this point in the history
  • Loading branch information
solumath committed Oct 17, 2024
1 parent 7a690eb commit f077bad
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions utils/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def is_mod_plus(
"""Check if user has permission for command mod or above."""
return cls.check_template(
ctx,
lambda ctx: (cls.is_bot_admin(ctx) or cls.role_check(ctx, PRIVILEGED_ROLES[:-2])),
lambda ctx: (
cls.is_bot_admin(ctx, raise_exception=False) or cls.role_check(ctx, PRIVILEGED_ROLES[:-2])
),
raise_exception,
PermissionError(Messages.mod_plus_only),
)
Expand All @@ -61,7 +63,9 @@ def is_submod_plus(

return cls.check_template(
ctx,
lambda ctx: cls.is_bot_admin(ctx) or cls.role_check(ctx, PRIVILEGED_ROLES[:-1]),
lambda ctx: (
cls.is_bot_admin(ctx, raise_exception=False) or cls.role_check(ctx, PRIVILEGED_ROLES[:-1])
),
raise_exception,
PermissionError(Messages.submod_plus_only),
)
Expand All @@ -75,7 +79,9 @@ def is_helper_plus(
"""Check if user has permission for command helper or above."""
return cls.check_template(
ctx,
lambda ctx: cls.is_bot_admin(ctx) or cls.role_check(ctx, PRIVILEGED_ROLES),
lambda ctx: (
cls.is_bot_admin(ctx, raise_exception=False) or cls.role_check(ctx, PRIVILEGED_ROLES)
),
raise_exception,
PermissionError(Messages.helper_plus_only),
)
Expand Down

0 comments on commit f077bad

Please sign in to comment.