From 042401c56b76f0074f6680e5f17694a7120d06cf Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Mon, 2 May 2022 02:21:22 -0600 Subject: [PATCH] Handle prefixed contexts better --- jarvis/client.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jarvis/client.py b/jarvis/client.py index 0269a57..667b80c 100644 --- a/jarvis/client.py +++ b/jarvis/client.py @@ -131,7 +131,8 @@ class Jarvis(Snake): self, ctx: Context, error: Exception, *args: list, **kwargs: dict ) -> None: """NAFF on_command_error override.""" - self.logger.debug(f"Handling error in {ctx.invoked_name}: {error}") + name = ctx.invoked_name if isinstance(ctx, InteractionContext) else ctx.invoked_target + self.logger.debug(f"Handling error in {name}: {error}") if isinstance(error, CommandOnCooldown): await ctx.send(str(error), ephemeral=True) return @@ -164,7 +165,7 @@ class Jarvis(Snake): full_message = ERROR_MSG.format( guild_name=ctx.guild.name, error_time=error_time, - invoked_name=ctx.invoked_name, + invoked_name=name, arg_str=arg_str, callback_args=callback_args, callback_kwargs=callback_kwargs, @@ -200,9 +201,8 @@ class Jarvis(Snake): # Modlog async def on_command(self, ctx: Context) -> None: """NAFF on_command override.""" - if isinstance(ctx, PrefixedContext): - return - if not isinstance(ctx.channel, DMChannel) and ctx.invoked_name not in ["pw"]: + name = ctx.invoked_name if isinstance(ctx, InteractionContext) else ctx.invoked_target + if not isinstance(ctx.channel, DMChannel) and name not in ["pw"]: modlog = await Setting.find_one(q(guild=ctx.guild.id, setting="activitylog")) if modlog: channel = await ctx.guild.fetch_channel(modlog.value)