From aeec616be516eb1337ab155b8eef6f78827e9bd5 Mon Sep 17 00:00:00 2001 From: Seaswimmer Date: Sat, 6 Jul 2024 11:32:33 -0400 Subject: [PATCH] fix(aurora): assume that `ctx` is a `commands.Context` object before trying to use it in `moderate` --- aurora/utilities/moderate.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aurora/utilities/moderate.py b/aurora/utilities/moderate.py index 7ae98cc..b0f6ca1 100644 --- a/aurora/utilities/moderate.py +++ b/aurora/utilities/moderate.py @@ -22,10 +22,6 @@ async def moderate(ctx: Union[commands.Context, discord.Interaction], target: di moderation_type (Type): The moderation type (handler) to use. See `aurora.models.moderation_types` for some examples. **kwargs: The keyword arguments to pass to the handler method. """ - if not await check_moddable(target, ctx, permissions): - return - if silent is None: - silent = not await config.guild(ctx.guild).dm_users() if isinstance(moderation_type, str): moderation_type = type_registry[str.lower(moderation_type)] if isinstance(ctx, discord.Interaction): @@ -33,6 +29,10 @@ async def moderate(ctx: Union[commands.Context, discord.Interaction], target: di ctx = await commands.Context.from_interaction(interaction) if isinstance(interaction.command, app_commands.ContextMenu): ctx.author = interaction.user + if not await check_moddable(target, ctx, permissions): + return + if silent is None: + silent = not await config.guild(ctx.guild).dm_users() return await moderation_type.handler( ctx, target,