diff --git a/PluralKit.Bot/Commands/Lists/ContextListExt.cs b/PluralKit.Bot/Commands/Lists/ContextListExt.cs index 8e209708..1bfc5fbd 100644 --- a/PluralKit.Bot/Commands/Lists/ContextListExt.cs +++ b/PluralKit.Bot/Commands/Lists/ContextListExt.cs @@ -36,7 +36,7 @@ namespace PluralKit.Bot if (ctx.MatchFlag("by-display-name", "bdn")) p.SortProperty = SortProperty.DisplayName; if (ctx.MatchFlag("by-id", "bid")) p.SortProperty = SortProperty.Hid; if (ctx.MatchFlag("by-message-count", "bmc")) p.SortProperty = SortProperty.MessageCount; - if (ctx.MatchFlag("by-created", "bc")) p.SortProperty = SortProperty.CreationDate; + if (ctx.MatchFlag("by-created", "bc", "bcd")) p.SortProperty = SortProperty.CreationDate; if (ctx.MatchFlag("by-last-fronted", "by-last-front", "by-last-switch", "blf", "bls")) p.SortProperty = SortProperty.LastSwitch; if (ctx.MatchFlag("by-last-message", "blm", "blp")) p.SortProperty = SortProperty.LastMessage; if (ctx.MatchFlag("by-birthday", "by-birthdate", "bbd")) p.SortProperty = SortProperty.Birthdate; @@ -67,6 +67,8 @@ namespace PluralKit.Bot p.IncludeCreated = true; if (ctx.MatchFlag("with-avatar", "with-image", "wa", "wi", "ia", "ii", "img")) p.IncludeAvatar = true; + if (ctx.MatchFlag("with-pronouns", "wp")) + p.IncludePronouns = true; // Always show the sort property, too if (p.SortProperty == SortProperty.LastSwitch) p.IncludeLastSwitch = true; @@ -110,15 +112,57 @@ namespace PluralKit.Bot // so run it through a helper that "makes it work" :) eb.WithSimpleLineContent(page.Select(m => { - if (m.HasProxyTags) - { - var proxyTagsString = m.ProxyTagsString(); - if (proxyTagsString.Length > 100) // arbitrary threshold for now, tweak? - proxyTagsString = "tags too long, see member card"; - return $"[`{m.Hid}`] **{m.NameFor(ctx)}** *(*{proxyTagsString}*)*"; - } + var ret = $"[`{m.Hid}`] **{m.NameFor(ctx)}** "; - return $"[`{m.Hid}`] **{m.NameFor(ctx)}**"; + switch (opts.SortProperty) { + case SortProperty.Birthdate: { + var birthday = m.BirthdayFor(lookupCtx); + if (birthday != null) + ret += $"(birthday: {m.BirthdayString})"; + break; + } + case SortProperty.MessageCount: { + if (m.MessageCountFor(lookupCtx) is {} count) + ret += $"({count} messages)"; + break; + } + case SortProperty.LastSwitch: { + if (m.MetadataPrivacy.TryGet(lookupCtx, m.LastSwitchTime, out var lastSw)) + ret += $"(last switched in: )"; + break; + } + case SortProperty.LastMessage: { + if (m.MetadataPrivacy.TryGet(lookupCtx, m.LastMessage, out var lastMsg)) + ret += $"(last message: )"; + break; + } + case SortProperty.CreationDate: { + if (m.MetadataPrivacy.TryGet(lookupCtx, m.Created, out var created)) + ret += $"(created at )"; + break; + } + default: { + if (opts.IncludeMessageCount && m.MessageCountFor(lookupCtx) is {} count) + ret += $"({count} messages)"; + else if (opts.IncludeLastSwitch && m.MetadataPrivacy.TryGet(lookupCtx, m.LastSwitchTime, out var lastSw)) + ret += $"(last switched in: )"; + else if (opts.IncludeLastMessage && m.MetadataPrivacy.TryGet(lookupCtx, m.LastMessage, out var lastMsg)) + ret += $"(last message: )"; + else if (opts.IncludeCreated && m.MetadataPrivacy.TryGet(lookupCtx, m.Created, out var created)) + ret += $"(created at )"; + else if (opts.IncludePronouns && m.PronounsFor(lookupCtx) is {} pronouns) + ret += $"({pronouns})"; + else if (m.HasProxyTags) + { + var proxyTagsString = m.ProxyTagsString(); + if (proxyTagsString.Length > 100) // arbitrary threshold for now, tweak? + proxyTagsString = "tags too long, see member card"; + ret += $"*(*{proxyTagsString}*)*"; + } + break; + } + } + return ret; })); } diff --git a/PluralKit.Bot/Commands/Lists/MemberListOptions.cs b/PluralKit.Bot/Commands/Lists/MemberListOptions.cs index 254188b4..4ae69552 100644 --- a/PluralKit.Bot/Commands/Lists/MemberListOptions.cs +++ b/PluralKit.Bot/Commands/Lists/MemberListOptions.cs @@ -26,6 +26,7 @@ namespace PluralKit.Bot public bool IncludeLastMessage { get; set; } public bool IncludeCreated { get; set; } public bool IncludeAvatar { get; set; } + public bool IncludePronouns { get; set; } public string CreateFilterString() { diff --git a/docs/content/tips-and-tricks.md b/docs/content/tips-and-tricks.md index 9451d0b4..22359ab3 100644 --- a/docs/content/tips-and-tricks.md +++ b/docs/content/tips-and-tricks.md @@ -64,6 +64,7 @@ You cannot look up private members of another system. |-with-message-count|-wmc|Show each member's message count| |-with-created|-wc|Show each member's creation date| |-with-avatar|-wa, -wi, -ia, -ii, -img|Show each member's avatar URL| +|-with-pronouns|-wp|Show each member's pronouns in the short list (shown by default in full list)| ::: warning These flags only work with the full member list (`pk;system list full`).