Fix ToString() on CommandInfo (#2094)

This commit is contained in:
Armano den Boef
2022-02-12 02:45:36 +01:00
committed by GitHub
parent 7e1b8c9db0
commit 01735c82fb
2 changed files with 5 additions and 14 deletions

View File

@@ -1,10 +0,0 @@
---
uid: Guides.Interactions.Intro
title: Introduction to Interactions
---
# Interactions
Placeholder text does the brrr.
Links to different sections of guides: msg comp / slash commands.

View File

@@ -253,20 +253,21 @@ namespace Discord.Interactions
/// <inheritdoc/> /// <inheritdoc/>
public override string ToString() public override string ToString()
{ {
StringBuilder builder = new(); List<string> builder = new();
var currentParent = Module; var currentParent = Module;
while (currentParent != null) while (currentParent != null)
{ {
if (currentParent.IsSlashGroup) if (currentParent.IsSlashGroup)
builder.AppendFormat(" {0}", currentParent.SlashGroupName); builder.Add(currentParent.SlashGroupName);
currentParent = currentParent.Parent; currentParent = currentParent.Parent;
} }
builder.AppendFormat(" {0}", Name); builder.Reverse();
builder.Add(Name);
return builder.ToString().Trim(); return string.Join(" ", builder);
} }
} }
} }