MCPcopy Index your code
hub / github.com/codebymitch/TitanBot / buildCountingLeaderboard

Function buildCountingLeaderboard

src/services/countingGameService.js:297–311  ·  view source on GitHub ↗
(config, guild)

Source from the content-addressed store, hash-verified

295}
296
297export function buildCountingLeaderboard(config, guild) {
298 const entries = Object.entries(config.leaderboard || {});
299 if (entries.length === 0) {
300 return [];
301 }
302
303 return entries
304 .sort((a, b) => b[1] - a[1])
305 .slice(0, 10)
306 .map(([userId, count], index) => {
307 const member = guild?.members?.cache?.get(userId);
308 const username = member ? `${member.user.username}#${member.user.discriminator}` : `<@${userId}>`;
309 return `**${index + 1}.** ${username} — ${count} ${count === 1 ? 'count' : 'counts'}`;
310 });
311}

Callers 1

executeFunction · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected