aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2020-01-12 20:10:23 +0100
committerGravatar Johannes Christ <[email protected]>2020-01-12 20:10:23 +0100
commitb0b9cdd0d54230c50bf6b4620909477d4adde8b7 (patch)
tree8eca63130c70c51ae50913550a683eb012393ad4
parentTrack command completions. (diff)
Use parent path properly.
-rw-r--r--bot/cogs/metrics.py17
1 files changed, 5 insertions, 12 deletions
diff --git a/bot/cogs/metrics.py b/bot/cogs/metrics.py
index aff1b0eb2..fa858bbd6 100644
--- a/bot/cogs/metrics.py
+++ b/bot/cogs/metrics.py
@@ -80,21 +80,14 @@ class Metrics(Cog):
async def on_command_completion(self, ctx: Context) -> None:
"""Increment the command completion counter."""
if ctx.message.guild is not None:
- path = []
- if (
- ctx.command.root_parent is not None
- and ctx.command.root_parent is not ctx.command.parent
- ):
- path.append(ctx.command.root_parent.name)
-
- if ctx.command.parent is not None:
- path.append(ctx.command.parent.name)
-
- path.append(ctx.command.name)
+ if ctx.command.full_parent_name:
+ command = f'{ctx.command.full_parent_name} {ctx.command.name}'
+ else:
+ command = ctx.command.name
self.command_completions.labels(
guild_id=ctx.message.guild.id,
- command=' '.join(path),
+ command=command,
).inc()