Skip to content

Commit

Permalink
[ExtendedModLog] Fix error in command permission checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
TrustyJAID committed Dec 10, 2023
1 parent 2e62771 commit 44813da
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion extendedmodlog/eventmixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,14 @@ async def on_command(self, ctx: commands.Context) -> None:
try:
com = ctx.command
privs = com.requires.privilege_level
user_perms = com.requires.user_perms
user_perms = com.requires.user_perms or discord.Permissions.none()
# If a subcommand requires only an exclusive privilege level check but its
# parent checks either privilege level or permissions extendedmodlog could fail
# to detect a commands required permissions and not log the usage.
# This is fixed by setting the permission value to a default of None
# then oring the values together to get the total requirements on the command.
# This appears more prominently with owner only subcommands with a top level
# command with permission requirements.
my_perms = com.requires.bot_perms
for p in com.parents:
if p.requires.privilege_level is not None:
Expand Down

0 comments on commit 44813da

Please sign in to comment.