From acdc54faf2feb7060cebc3d9395fab38039ffc82 Mon Sep 17 00:00:00 2001 From: O3H Date: Sat, 27 Jul 2024 12:43:27 +0100 Subject: [PATCH] rename transitions --- aurora/slashcommands/townless.ts | 2 +- bot/types.ts | 2 +- bot/updater.ts | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/aurora/slashcommands/townless.ts b/aurora/slashcommands/townless.ts index bf0d8637..938bf5b0 100644 --- a/aurora/slashcommands/townless.ts +++ b/aurora/slashcommands/townless.ts @@ -100,7 +100,7 @@ export default { `${p.name} (Seen ${(diff / 1000).toFixed(0)}s ago)` }).join('\n').match(/(?:^.*$\n?){1,15}/mg) - console.log(townless.map(p => `${p.name} - ${p.transitions} transitions.`)) + console.log(townless.map(p => `${p.name} - vanished ${p.timesVanished} times. Currently: ${p.online ? "Online" : "Offline"}`)) return send(interaction, allData, townless) }, data: new SlashCommandBuilder() diff --git a/bot/types.ts b/bot/types.ts index 7c949fb0..9595eef5 100644 --- a/bot/types.ts +++ b/bot/types.ts @@ -231,7 +231,7 @@ export interface V3Player extends Entity { } export interface SeenPlayer extends SquaremapOnlinePlayer { - transitions: number + timesVanished: number online: boolean timestamp: number } diff --git a/bot/updater.ts b/bot/updater.ts index 578a3a00..6f6fb740 100644 --- a/bot/updater.ts +++ b/bot/updater.ts @@ -285,10 +285,10 @@ async function updateLastSeen() { for (const op of ops) { const seen = lastSeenPlayers.get(op.name) - if (!op['transitions']) op['transitions'] = 0 - if (!seen?.online) op['transitions']++ + if (!op['timesVanished']) op['timesVanished'] = 0 + if (seen && !seen.online) op['timesVanished']++ - op['timestamp'] = now + op['timesVanished'] = now lastSeenPlayers.set(op.name, op as SeenPlayer) }