diff --git a/moderation/moderation.py b/moderation/moderation.py index deb2875..4b9cc57 100644 --- a/moderation/moderation.py +++ b/moderation/moderation.py @@ -177,12 +177,16 @@ class Moderation(commands.Cog): not_found_list.append(item) return not_found_list - def check_permissions(self, member: discord.Member, permissions: list, ctx: Union[commands.Context, discord.Interaction] = None): + def check_permissions(self, user: discord.User, permissions: list, guild: discord.Guild = None, ctx: Union[commands.Context, discord.Interaction] = None): """Checks if the bot has a specific permission (or a list of permissions) in a channel.""" if ctx: + member = ctx.guild.get_member(user.id) resolved_permissions = ctx.channel.permissions_for(member) - else: + elif guild: + member = guild.get_member(user.id) resolved_permissions = member.guild_permissions + else: + raise(KeyError) for permission in permissions: if not getattr(resolved_permissions, permission, False) and not resolved_permissions.administrator is True: return permission