From bac39ca17640e4f12e76da4f980f42415e792910 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Fri, 8 Sep 2023 16:30:44 +0000 Subject: [PATCH 1/3] 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 [ From 63a8a67771e389b9e37c0fdb1fc3971f8b39ab4a Mon Sep 17 00:00:00 2001 From: tresabhi Date: Fri, 8 Sep 2023 16:38:08 +0000 Subject: [PATCH 2/3] fix: better approximation message and players with 0 wins are omitted --- scripts/build.js | 4 +++- src/commands/clanEvent.ts | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/build.js b/scripts/build.js index d334ec3a6..9e124599e 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -26,7 +26,9 @@ files.forEach(async (file) => { bundle: true, sourcemap: true, - minify: true, + minifyIdentifiers: false, // cause goofy errors + minifySyntax: true, + minifyWhitespace: true, logLevel: 'info', }); diff --git a/src/commands/clanEvent.ts b/src/commands/clanEvent.ts index ce101b19e..ab68f374f 100644 --- a/src/commands/clanEvent.ts +++ b/src/commands/clanEvent.ts @@ -78,6 +78,7 @@ export const clanEventCommand: CommandRegistry = { 0, ) / 2 ).toFixed(0)}\n${jointVictories + .filter(({ joinVictory }) => joinVictory) .sort((a, b) => b.joinVictory - a.joinVictory) .map( ({ id, joinVictory }) => @@ -87,7 +88,7 @@ export const clanEventCommand: CommandRegistry = { embedWarning( 'This is an approximation!', - 'Wargaming provides use with little to no information about platoons. Platooning with mixed clans may inflate the number and platooning in non-regular battles may deflate.', + "Wargaming provides very little information about platoons publicly. Caveats:\n- Players in two different clans platooning artificially inflates the total count\n- Game-mode battles aren't counted since Wargaming doesn't track them", ), ]; }, From 7d235057e8822e46a74033b003abb1bba1c9e3c6 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Fri, 8 Sep 2023 16:41:06 +0000 Subject: [PATCH 3/3] feat: changelogs --- docs/changelogs/1.12.5.md | 4 ++-- docs/changelogs/1.12.6.md | 12 ++++++++++++ package.json | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 docs/changelogs/1.12.6.md diff --git a/docs/changelogs/1.12.5.md b/docs/changelogs/1.12.5.md index e99703bef..65e6fd32e 100644 --- a/docs/changelogs/1.12.5.md +++ b/docs/changelogs/1.12.5.md @@ -1,4 +1,4 @@ -# Blitzkrieg 1.12.4 +# Blitzkrieg 1.12.5 Some patch up work @@ -6,7 +6,7 @@ Some patch up work - `/clan-event` now is more legible and comes with an approximation warning -## Fixed +## Fixes - `/clan-event` now uses a more optimized way of fetching large data - This should fix the issue where too many people using the command broke it diff --git a/docs/changelogs/1.12.6.md b/docs/changelogs/1.12.6.md new file mode 100644 index 000000000..347c948a1 --- /dev/null +++ b/docs/changelogs/1.12.6.md @@ -0,0 +1,12 @@ +# Blitzkrieg 1.12.6 + +Stops making the bot lie! + +## Changes + +- The approximation warning for `/clan-event` has been made more concise +- Players with `0` wins are now omitted + +## Fixes + +- Players who haven't player within the current day are now omitted diff --git a/package.json b/package.json index 7e3054a9b..372d592ff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blitzkrieg", - "version": "1.12.1", + "version": "1.12.6", "description": "🎉 All-in-one Discord bot for everything World of Tanks Blitz", "main": "src/server.ts", "type": "module",