Fix context accessing to use invoked_name
This commit is contained in:
parent
042401c56b
commit
96ee4edf48
1 changed files with 4 additions and 4 deletions
|
@ -89,7 +89,7 @@ class Jarvis(Snake):
|
|||
self.logger.debug(f"{add} additions, {sub} removals")
|
||||
|
||||
async def _prerun(self, ctx: Context, *args, **kwargs) -> None:
|
||||
name = ctx.invoked_name
|
||||
name = ctx.invoke_target
|
||||
if isinstance(ctx, InteractionContext) and ctx.target_id:
|
||||
kwargs["context target"] = ctx.target
|
||||
args = " ".join(f"{k}:{v}" for k, v in kwargs.items())
|
||||
|
@ -131,7 +131,7 @@ class Jarvis(Snake):
|
|||
self, ctx: Context, error: Exception, *args: list, **kwargs: dict
|
||||
) -> None:
|
||||
"""NAFF on_command_error override."""
|
||||
name = ctx.invoked_name if isinstance(ctx, InteractionContext) else ctx.invoked_target
|
||||
name = ctx.invoke_target
|
||||
self.logger.debug(f"Handling error in {name}: {error}")
|
||||
if isinstance(error, CommandOnCooldown):
|
||||
await ctx.send(str(error), ephemeral=True)
|
||||
|
@ -201,7 +201,7 @@ class Jarvis(Snake):
|
|||
# Modlog
|
||||
async def on_command(self, ctx: Context) -> None:
|
||||
"""NAFF on_command override."""
|
||||
name = ctx.invoked_name if isinstance(ctx, InteractionContext) else ctx.invoked_target
|
||||
name = ctx.invoke_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:
|
||||
|
@ -225,7 +225,7 @@ class Jarvis(Snake):
|
|||
fields = [
|
||||
EmbedField(
|
||||
name="Command",
|
||||
value=f"```ansi\n{CMD_FMT}{ctx.invoked_name}{RESET} {args}\n```",
|
||||
value=f"```ansi\n{CMD_FMT}{ctx.invoke_target}{RESET} {args}\n```",
|
||||
inline=False,
|
||||
),
|
||||
]
|
||||
|
|
Loading…
Add table
Reference in a new issue