From e901cc84d8ac4b43cf14d9e5b1cb71eba48748bb Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Tue, 1 Oct 2024 21:26:17 +1000 Subject: [PATCH] Fix race condition for `rules` --- src/commands/mp.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/commands/mp.ts b/src/commands/mp.ts index 20531f5..9e2fd99 100644 --- a/src/commands/mp.ts +++ b/src/commands/mp.ts @@ -149,11 +149,9 @@ export default class MP { const filter = DSS?.vehicles.filter(x=>CATEGORY_FILTER.includes(x.category)); const rules = { one: 'single pallet', - two: 'pallets', - few: 'pallets', other: 'pallets' }[new Intl.PluralRules('en', {type: 'ordinal'}).select(filter.length)]; - if (filter.length < 1) return interaction.editReply('No pallets found on the server.'); + if (filter.length === 0) return interaction.editReply('No pallets found on the server.'); else { const getLongestName = Object.entries(this.getPalletCounts(DSS)).map(([name, _])=>name.length).sort((a,b)=>b-a)[0]; await interaction.editReply(MessageTool.concatMessage(