Última actividad 2 weeks ago

nuno revisó este gist 2 weeks ago. Ir a la revisión

1 file changed, 28 insertions

gistfile1.txt(archivo creado)

@@ -0,0 +1,28 @@
1 +
2 + export const Leaderboard = {
3 + /**
4 + * Build and post/edit the leaderboard for the current week.
5 + * Called after each score submission and on weekly reset.
6 + */
7 + async update({ weekKey }: { weekKey?: string } = {}): Promise<void> {
8 + const client = DiscordClient.get();
9 + const channelId = Config.get({ section: "channels", key: "leaderboard" });
10 + if (!channelId) { log.warn("leaderboard channel not configured"); return; }
11 +
12 + const week = weekKey ? WRank.weekFromKey(weekKey) : WRank.currentWeek();
13 +
14 + if (!week) { log.warn(`Week ${weekKey} not found`); return; }
15 +
16 + const embed = LeaderboardUI.buildEmbed(week, entries as any);
17 +
18 + await PersistentMessage.post({
19 + store: "leaderboard",
20 + key: week.weekKey,
21 + channelId,
22 + embeds: [embed],
23 + client,
24 + });
25 +
26 + log.info(`Leaderboard updated for ${week.weekKey}`);
27 + },
28 + };
Siguiente Anterior