fix(aurora): assume that ctx
is a commands.Context
object before trying to use it in moderate
This commit is contained in:
parent
9f068bba6f
commit
aeec616be5
1 changed files with 4 additions and 4 deletions
|
@ -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.
|
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.
|
**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):
|
if isinstance(moderation_type, str):
|
||||||
moderation_type = type_registry[str.lower(moderation_type)]
|
moderation_type = type_registry[str.lower(moderation_type)]
|
||||||
if isinstance(ctx, discord.Interaction):
|
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)
|
ctx = await commands.Context.from_interaction(interaction)
|
||||||
if isinstance(interaction.command, app_commands.ContextMenu):
|
if isinstance(interaction.command, app_commands.ContextMenu):
|
||||||
ctx.author = interaction.user
|
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(
|
return await moderation_type.handler(
|
||||||
ctx,
|
ctx,
|
||||||
target,
|
target,
|
||||||
|
|
Loading…
Reference in a new issue