From 44813dacd58b5ea64837460fa5e87fbc1da9c9f2 Mon Sep 17 00:00:00 2001 From: TrustyJAID Date: Sun, 10 Dec 2023 11:41:04 -0700 Subject: [PATCH] [ExtendedModLog] Fix error in command permission checks. --- extendedmodlog/eventmixin.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extendedmodlog/eventmixin.py b/extendedmodlog/eventmixin.py index 446c06dda5..9daa290407 100644 --- a/extendedmodlog/eventmixin.py +++ b/extendedmodlog/eventmixin.py @@ -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: