change messages for user

This commit is contained in:
Nuno Duque Nunes 2026-06-09 23:15:44 +01:00
parent 88f53dff32
commit f2972567c4
8 changed files with 33 additions and 25 deletions

View file

@ -7,7 +7,7 @@
"invicjusz": "invicjusz",
"mrsean.": "sean",
"ibenni": "ayana",
"zephyr_74135": "zephyr",
"izephyrxy": "zephyr",
"eat.jim.sleep": "keira",
"mar1n1987": "marin",
"coba5539": "cobain"

View file

@ -34,7 +34,6 @@
"wrank_down_5": "<:wrank_down_5:1512125030765691072>",
"wrank_neutral": "<:wrank_neutral:1511950713713070160>",
"wrank_neutral_0": "<:wrank_neutral_0:1511950717290545354>",
"wrank_no_rank": "<:wrank_no_rank:1511956384177062018>",
"wrank_no_dash": "<:wrank_no_dash:1511956379403943979>",
"wrank_up_1": "<:wrank_up_1:1512125132242554890>",
"wrank_up_10": "<:wrank_up_10:1512125136445243503>",
@ -101,5 +100,7 @@
"wrank_6_gold": "<:wrank_6_gold:1512125115956203601>",
"wrank_7_gold": "<:wrank_7_gold:1512125120204771338>",
"wrank_8_gold": "<:wrank_8_gold:1512125123874918661>",
"wrank_9_gold": "<:wrank_9_gold:1512125128299905104>"
"wrank_9_gold": "<:wrank_9_gold:1512125128299905104>",
"wrank_no_rank": "<:wrank_no_rank:1512261782205628606>",
"wrank_no_rank_delta": "<:wrank_no_rank_delta:1512263603519229982>"
}

View file

@ -1,15 +1,21 @@
{
"public": {
"yes": [
{ "clicks": 1, "random": true, "messages": ["Dey is in", "Dey is in... for now", "Welcome indeed!", "A bit of this, a bit of that."]},
{ "clicks": 2, "random": true, "messages": ["Courageous now, new account afterall"] },
{ "clicks": 1, "random": true, "messages": [
"Dey is in",
"Dey is in... for now",
"Welcome indeed!",
"A bit of this, a bit of that.",
"Come and see what goods I offer"
]},
{ "clicks": 10, "random": true, "messages": ["Now you're just asking for it."] }
],
"no": [
{ "clicks": 1, "random": true, "messages": [
"Everything's for sale",
"Dey roaching out 🪳",
"Dey said no... shocking"
"Dey said no... shocking",
"No more... I yield!"
]
}
]

View file

@ -4,9 +4,11 @@
{
"clicks": 1,
"random": true,
"messages": ["Flash? Flash? Flash!!", "The King has arrived. 👑", "Flash is in, bow down.","{alias[0]} is in"]
},
{ "clicks": 2, "random": true, "messages": ["Flash? Flash? Flash!!"] }
"messages": [
"<:wi:1511906503647563807>+<:storm_bringer:1511906496097554594>=<:kd:1511906474497146983>",
"<:wi:1511906503647563807> Powaaaaaaaaa"
]
}
],
"no": [
{ "clicks": 1, "random": true, "messages": [

View file

@ -49,15 +49,6 @@ export async function handleRankPost(interaction: ChatInputCommandInteraction):
)
.setTimestamp();
// const embed = new EmbedBuilder()
// .setTitle(`⚔️ W.Rank Leaderboard — ${weekKey}`)
// .setColor(0xe8a317)
// .addFields(
// { name: "🔵 Capella", value: formatNation("capella"), inline: true },
// { name: "🔴 Procyon", value: formatNation("procyon"), inline: true },
// )
// .setTimestamp();
const channelId = cfg("resultsChannelId") || cfg("pollChannelId");
const channel = await interaction.client.channels.fetch(channelId) as TextChannel;
await channel.send({ embeds: [embed] });

View file

@ -111,11 +111,13 @@ function wrankFull(entry: WRankEntry, options: WRankDisplayOptions): string {
* Output: ( [] )
*/
function wrankNoRank(): string {
const dash = getEmoji("wrank_no_dash") || "—";
const norank = getEmoji("wrank_no_dash") || "—";
const dash = getEmoji("wrank_no_rank_delta") || "—";
const square = getEmoji("wrank_no_dash") || "■";
return `${dash} (${square} ${dash})`;
return `${norank} (${square}${dash})`;
}
// ─── Namespace export ─────────────────────────────────────────────────────────
export const format = {

View file

@ -42,7 +42,7 @@ export function upsertScore(score: TGScore): void {
// Overwrite existing score for this player+slot
result.scores = result.scores.filter(
(s) => !(s.userKey === score.userKey && s.slot === score.slot && s.date === score.date)
(s) => !(s.userKey === score.userKey && s.characterName === score.characterName && s.slot === score.slot && s.date === score.date)
);
result.scores.push(score);
saveResult(result);

View file

@ -99,12 +99,16 @@ export function recordScore(
}
function recomputeRanks(week: WRankWeek, nation: Nation): void {
const list = week.entries[nation.toLowerCase() as "capella" | "procyon"];
const list = week.entries[nation.toLowerCase() as "capella" | "procyon"];
const sorted = [...list].sort((a, b) => b.weeklyPoints - a.weeklyPoints);
sorted.forEach((entry, i) => {
const live = list.find((e) => e.characterName === entry.characterName)!;
live.previousRank = live.currentRank || undefined;
live.currentRank = i + 1;
const live = list.find((e) => e.characterName === entry.characterName)!;
const newRank = i + 1;
// Only snapshot previousRank when rank actually changes
if (live.currentRank !== 0 && live.currentRank !== newRank) {
live.previousRank = live.currentRank;
}
live.currentRank = newRank;
});
}
@ -146,6 +150,8 @@ export function getBringer(nation: Nation): string | null {
export function getEntry(characterName: string, nation: Nation): WRankEntry | null {
const week = getCurrentWeek();
const list = week.entries[nation.toLowerCase() as "capella" | "procyon"];
console.log(`[getEntry] weekKey=${week.weekKey} nation=${nation} listLength=${list?.length} looking for=${characterName}`);
console.log(`[getEntry] available:`, list?.map(e => e.characterName));
return list.find((e) => e.characterName === characterName) ?? null;
}