From 44fe3d538a5ee30dba259d9d3340a01cac624c0b Mon Sep 17 00:00:00 2001 From: spiral Date: Thu, 22 Sep 2022 17:29:34 +0000 Subject: [PATCH] feat(bot): -with-birthday flag on member lists --- PluralKit.Bot/Commands/Lists/ContextListExt.cs | 7 +++++++ PluralKit.Bot/Commands/Lists/ListOptions.cs | 2 ++ 2 files changed, 9 insertions(+) diff --git a/PluralKit.Bot/Commands/Lists/ContextListExt.cs b/PluralKit.Bot/Commands/Lists/ContextListExt.cs index d0891787..57096c44 100644 --- a/PluralKit.Bot/Commands/Lists/ContextListExt.cs +++ b/PluralKit.Bot/Commands/Lists/ContextListExt.cs @@ -75,6 +75,8 @@ public static class ContextListExt p.IncludePronouns = true; if (ctx.MatchFlag("with-displayname", "wdn")) p.IncludeDisplayName = true; + if (ctx.MatchFlag("with-birthday", "wbd", "wb")) + p.IncludeBirthday = true; // Always show the sort property, too (unless this is the short list) if (p.Type != ListType.Short) @@ -84,6 +86,7 @@ public static class ContextListExt if (p.SortProperty == SortProperty.CreationDate) p.IncludeCreated = true; if (p.SortProperty == SortProperty.LastSwitch) p.IncludeLastSwitch = true; if (p.SortProperty == SortProperty.LastMessage) p.IncludeLastMessage = true; + if (p.SortProperty == SortProperty.Birthdate) p.IncludeBirthday = true; } // Make sure the options are valid @@ -197,6 +200,10 @@ public static class ContextListExt { ret += $"({pronouns})"; } + else if (opts.IncludeBirthday && m.BirthdayFor(lookupCtx) is {} birthday) + { + ret += $"(birthday: {m.BirthdayString})"; + } else if (m.HasProxyTags) { var proxyTagsString = m.ProxyTagsString(); diff --git a/PluralKit.Bot/Commands/Lists/ListOptions.cs b/PluralKit.Bot/Commands/Lists/ListOptions.cs index ce5e2fd7..3a6937d3 100644 --- a/PluralKit.Bot/Commands/Lists/ListOptions.cs +++ b/PluralKit.Bot/Commands/Lists/ListOptions.cs @@ -40,6 +40,7 @@ public class ListOptions public bool IncludeAvatar { get; set; } public bool IncludePronouns { get; set; } public bool IncludeDisplayName { get; set; } + public bool IncludeBirthday { get; set; } public string CreateFilterString() { @@ -174,6 +175,7 @@ public static class ListOptionsExt opts.IncludeAvatar, opts.IncludePronouns, opts.IncludeDisplayName, + opts.IncludeBirthday, }.Sum(x => Convert.ToInt32(x)) > 1; if (hasMultipleIncluded)