Barebones, untested sort/filtering
This commit is contained in:
30
PluralKit.Bot/Lists/ShortRenderer.cs
Normal file
30
PluralKit.Bot/Lists/ShortRenderer.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using DSharpPlus.Entities;
|
||||
|
||||
namespace PluralKit.Bot
|
||||
{
|
||||
public class ShortRenderer: IListRenderer
|
||||
{
|
||||
public int MembersPerPage => 25;
|
||||
|
||||
public void RenderPage(DiscordEmbedBuilder eb, IEnumerable<PKListMember> members)
|
||||
{
|
||||
eb.Description = string.Join("\n", members.Select(m =>
|
||||
{
|
||||
if (m.HasProxyTags)
|
||||
{
|
||||
var proxyTagsString = m.ProxyTagsString().SanitizeMentions();
|
||||
if (proxyTagsString.Length > 100) // arbitrary threshold for now, tweak?
|
||||
proxyTagsString = "tags too long, see member card";
|
||||
|
||||
return $"[`{m.Hid}`] **{m.Name.SanitizeMentions()}** *({proxyTagsString})*";
|
||||
}
|
||||
|
||||
return $"[`{m.Hid}`] **{m.Name.SanitizeMentions()}**";
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user