diff options
| author | 2020-01-12 20:10:23 +0100 | |
|---|---|---|
| committer | 2020-01-12 20:10:23 +0100 | |
| commit | b0b9cdd0d54230c50bf6b4620909477d4adde8b7 (patch) | |
| tree | 8eca63130c70c51ae50913550a683eb012393ad4 | |
| parent | Track command completions. (diff) | |
Use parent path properly.
Diffstat (limited to '')
| -rw-r--r-- | bot/cogs/metrics.py | 17 | 
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() | 
