Zuletzt aktiv 2 weeks ago

Änderung d815841324af247cd80b2a89d225078b269b8b7a

gistfile1.txt Originalformat
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 };