feat(bot): -with-birthday flag on member lists

This commit is contained in:
spiral 2022-09-22 17:29:34 +00:00
parent 47449ecbc7
commit 44fe3d538a
No known key found for this signature in database
GPG Key ID: 244A11E4B0BCF40E
2 changed files with 9 additions and 0 deletions

View File

@ -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();

View File

@ -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)