1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 00:10:58 -05:00

Fix race condition for rules

This commit is contained in:
toast-ts 2024-10-01 21:26:17 +10:00
parent b9d15b0982
commit e901cc84d8

View File

@ -149,11 +149,9 @@ export default class MP {
const filter = DSS?.vehicles.filter(x=>CATEGORY_FILTER.includes(x.category)); const filter = DSS?.vehicles.filter(x=>CATEGORY_FILTER.includes(x.category));
const rules = { const rules = {
one: 'single pallet', one: 'single pallet',
two: 'pallets',
few: 'pallets',
other: 'pallets' other: 'pallets'
}[new Intl.PluralRules('en', {type: 'ordinal'}).select(filter.length)]; }[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 { else {
const getLongestName = Object.entries(this.getPalletCounts(DSS)).map(([name, _])=>name.length).sort((a,b)=>b-a)[0]; const getLongestName = Object.entries(this.getPalletCounts(DSS)).map(([name, _])=>name.length).sort((a,b)=>b-a)[0];
await interaction.editReply(MessageTool.concatMessage( await interaction.editReply(MessageTool.concatMessage(