diff options
Diffstat (limited to 'src/discord')
| -rw-r--r-- | src/discord/embeds.ts | 23 |
1 files changed, 23 insertions, 0 deletions
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 }, |