diff options
| author | Fuwn <[email protected]> | 2025-09-13 16:12:15 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-09-13 16:12:15 -0700 |
| commit | e057df4be5fce92b52a44961a10dfc36c4f1189c (patch) | |
| tree | 33b0b18b7f291bf849056bd49b125d4f68d42ff9 /src/discord | |
| parent | feat: Colour role distribution command (diff) | |
| download | umabotdiscord-e057df4be5fce92b52a44961a10dfc36c4f1189c.tar.xz umabotdiscord-e057df4be5fce92b52a44961a10dfc36c4f1189c.zip | |
refactor(server): Move role distribution embed to embeds module
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 }, |