PluralKit/PluralKit.Bot/Lists/ShortRenderer.cs
2020-06-04 13:21:47 +02:00

30 lines
935 B
C#

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()}**";
}));
}
}
}