fix: don't pad HIDs in lists only containing old 5 character ones

This commit is contained in:
Iodine 2024-10-21 01:45:31 -04:00 committed by alyssa
parent f5b6afed08
commit 35ce4e8da2
2 changed files with 12 additions and 6 deletions

View file

@ -127,11 +127,14 @@ public static class ContextListExt
void ShortRenderer(EmbedBuilder eb, IEnumerable<ListedMember> page)
{
// if there are both 5 and 6 character Hids they should be padded to align correctly.
var shouldPad = page.Any(x => x.Hid.Length > 5);
// We may end up over the description character limit
// so run it through a helper that "makes it work" :)
eb.WithSimpleLineContent(page.Select(m =>
{
var ret = $"[`{m.DisplayHid(ctx.Config, isList: true)}`] **{m.NameFor(ctx)}** ";
var ret = $"[`{m.DisplayHid(ctx.Config, isList: true, shouldPad: shouldPad)}`] **{m.NameFor(ctx)}** ";
if (opts.IncludeMessageCount && m.MessageCountFor(lookupCtx) is { } count)
ret += $"({count} messages)";
@ -237,11 +240,14 @@ public static class ContextListExt
void ShortRenderer(EmbedBuilder eb, IEnumerable<ListedGroup> page)
{
// if there are both 5 and 6 character Hids they should be padded to align correctly.
var shouldPad = page.Any(x => x.Hid.Length > 5);
// We may end up over the description character limit
// so run it through a helper that "makes it work" :)
eb.WithSimpleLineContent(page.Select(g =>
{
var ret = $"[`{g.DisplayHid(ctx.Config, isList: true)}`] **{g.NameFor(ctx)}** ";
var ret = $"[`{g.DisplayHid(ctx.Config, isList: true, shouldPad: shouldPad)}`] **{g.NameFor(ctx)}** ";
switch (opts.SortProperty)
{