fix(bot): clean up hid padding code

This commit is contained in:
alyssa 2024-06-04 18:56:28 +09:00
parent 80b685ae9b
commit 1f11dbf269
5 changed files with 24 additions and 14 deletions

View file

@ -66,7 +66,7 @@ public class GroupMember
if (groups.Count == 0)
description = "This member has no groups.";
else
description = string.Join("\n", groups.Select(g => $"[`{g.DisplayHid(ctx.Config)}`] **{g.DisplayName ?? g.Name}**"));
description = string.Join("\n", groups.Select(g => $"[`{g.DisplayHid(ctx.Config, isList: true)}`] **{g.DisplayName ?? g.Name}**"));
if (pctx == LookupContext.ByOwner)
{

View file

@ -128,9 +128,7 @@ public static class ContextListExt
// so run it through a helper that "makes it work" :)
eb.WithSimpleLineContent(page.Select(m =>
{
var leftpad = m.Hid.Length == 5 && ctx.Config?.HidListPadding == SystemConfig.HidPadFormat.Left ? " " : "";
var rightpad = m.Hid.Length == 5 && ctx.Config?.HidListPadding == SystemConfig.HidPadFormat.Right ? " " : "";
var ret = $"[`{leftpad}{m.DisplayHid(ctx.Config)}{rightpad}`] **{m.NameFor(ctx)}** ";
var ret = $"[`{m.DisplayHid(ctx.Config, isList: true)}`] **{m.NameFor(ctx)}** ";
if (opts.IncludeMessageCount && m.MessageCountFor(lookupCtx) is { } count)
ret += $"({count} messages)";
@ -240,9 +238,7 @@ public static class ContextListExt
// so run it through a helper that "makes it work" :)
eb.WithSimpleLineContent(page.Select(g =>
{
var leftpad = g.Hid.Length == 5 && ctx.Config?.HidListPadding == SystemConfig.HidPadFormat.Left ? " " : "";
var rightpad = g.Hid.Length == 5 && ctx.Config?.HidListPadding == SystemConfig.HidPadFormat.Right ? " " : "";
var ret = $"[`{leftpad}{g.DisplayHid(ctx.Config)}{rightpad}`] **{g.NameFor(ctx)}** ";
var ret = $"[`{g.DisplayHid(ctx.Config, isList: true)}`] **{g.NameFor(ctx)}** ";
switch (opts.SortProperty)
{