Skip to content

Commit

Permalink
fix(leaderboard): make it less ugly (aaaa)
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-737 committed Feb 23, 2025
1 parent 78e4732 commit 90fbfa4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/utils/Leaderboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,16 @@ export async function formatServerLeaderboard(
const guild = (await client.fetchGuild(serverId).catch(() => null)) ?? { name: 'Unknown' };

// Limit the server name length for table formatting.
const serverName = guild.name.length > 20 ? `${guild.name.slice(0, 17)}...` : guild.name;
const serverData = inviteLinks.find((link) => link.id === serverId && Boolean(link.inviteCode));
const inviteCode =
serverData?.inviteCode ?? ('vanityURLCode' in guild ? guild.vanityURLCode : null);
const invite = inviteCode ? `([join](https://discord.gg/${inviteCode}))` : '';
const invite = inviteCode ? `([join server](https://discord.gg/${inviteCode}))` : '';

// Use the helper function to get the rank display value.
const rankDisplay = getRankDisplay(rank, getEmoji('dot', client));

// Pad each column for alignment.
output += `${rankDisplay} \` ${score.toString()} \` - ${serverName} ${invite}\n`;
output += `${rankDisplay} \` ${score.toString()} msgs \` - ${guild.name} ${invite}\n`;
}

return output;
Expand Down

0 comments on commit 90fbfa4

Please sign in to comment.