From bac39ca17640e4f12e76da4f980f42415e792910 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Fri, 8 Sep 2023 16:30:44 +0000 Subject: [PATCH] fix: only use players who have played within the last day --- src/commands/clanEvent.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/commands/clanEvent.ts b/src/commands/clanEvent.ts index 18e133cd1..ce101b19e 100644 --- a/src/commands/clanEvent.ts +++ b/src/commands/clanEvent.ts @@ -2,6 +2,7 @@ import { SlashCommandBuilder } from 'discord.js'; import markdownEscape from 'markdown-escape'; import getWargamingResponse from '../core/blitz/getWargamingResponse'; import { PlayerHistoriesRaw } from '../core/blitzstars/getPlayerHistories'; +import getTimeDaysAgo from '../core/blitzstars/getTimeDaysAgo'; import addClanChoices from '../core/discord/addClanChoices'; import autocompleteClan from '../core/discord/autocompleteClan'; import embedWarning from '../core/discord/embedWarning'; @@ -16,7 +17,6 @@ const DEFAULT_THRESHOLD = 7; export const clanEventCommand: CommandRegistry = { inProduction: true, - inDevelopment: true, inPublic: true, command: new SlashCommandBuilder() @@ -63,10 +63,12 @@ export const clanEventCommand: CommandRegistry = { const jointVictories = clan.members_ids.map((id) => ({ id, joinVictory: - previousJointVictories[id] === undefined - ? 0 - : achievements[id].max_series.jointVictory - - previousJointVictories[id]!, + players[id].last_battle_time > getTimeDaysAgo(region, 1) + ? previousJointVictories[id] === undefined + ? 0 + : achievements[id].max_series.jointVictory - + previousJointVictories[id]! + : 0, })); return [