From e057df4be5fce92b52a44961a10dfc36c4f1189c Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sat, 13 Sep 2025 16:12:15 -0700 Subject: refactor(server): Move role distribution embed to embeds module --- src/discord/embeds.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/discord') diff --git a/src/discord/embeds.ts b/src/discord/embeds.ts index db23f80..2eeb800 100644 --- a/src/discord/embeds.ts +++ b/src/discord/embeds.ts @@ -89,6 +89,29 @@ export const createPostEmbed = (post: RedditPost): DiscordEmbed => { return embed; }; +export const createRoleDistributionEmbed = ( + roleDistribution: Array<{ name: string; count: number }>, +): DiscordEmbed => { + const totalMembers = roleDistribution.reduce( + (sum, role) => sum + role.count, + 0, + ); + + return { + title: "🎨 Colour Role Distribution", + description: `Total members with colour roles: **${totalMembers}**`, + color: 0x5865f2, + fields: roleDistribution.map((role) => ({ + name: role.name, + value: `${role.count} member${role.count !== 1 ? "s" : ""}`, + inline: true, + })), + footer: { + text: "Sorted by member count (highest to lowest)", + }, + }; +}; + export const createComplaintEmbed = ( complaintContent: string, complainant: { username: string; id: string; avatar?: string }, -- cgit v1.2.3