make result auto pluralize

This commit is contained in:
Ean Milligan 2025-04-28 19:50:54 -04:00
parent 6b198ecb47
commit bba4217bd7
1 changed files with 7 additions and 4 deletions

View File

@ -211,6 +211,9 @@ export const parseRoll = (fullCmd: string, modifiers: RollModifiers): SolvedRoll
let line2 = '';
let line3 = '';
// The ': ' is used by generateRollEmbed to split line 2 up
const resultStr = tempReturnData.length > 1 ? 'Results: ' : 'Result: ';
// If a theoretical roll is requested, mark the output as such, else use default formatting
if (modifiers.maxRoll || modifiers.minRoll || modifiers.nominalRoll) {
const theoreticalTexts = ['Maximum', 'Minimum', 'Nominal'];
@ -218,18 +221,18 @@ export const parseRoll = (fullCmd: string, modifiers: RollModifiers): SolvedRoll
const theoreticalText = theoreticalTexts[theoreticalBools.indexOf(true)];
line1 = ` requested the Theoretical ${theoreticalText} of:\n\`${config.prefix}${fullCmd}\``;
line2 = `Theoretical ${theoreticalText} Results: `;
line2 = `Theoretical ${theoreticalText} ${resultStr}`;
} else if (modifiers.order === 'a') {
line1 = ` requested the following rolls to be ordered from least to greatest:\n\`${config.prefix}${fullCmd}\``;
line2 = 'Results: ';
line2 = resultStr;
tempReturnData.sort(compareTotalRolls);
} else if (modifiers.order === 'd') {
line1 = ` requested the following rolls to be ordered from greatest to least:\n\`${config.prefix}${fullCmd}\``;
line2 = 'Results: ';
line2 = resultStr;
tempReturnData.sort(compareTotalRollsReverse);
} else {
line1 = ` rolled:\n\`${config.prefix}${fullCmd}\``;
line2 = 'Results: ';
line2 = resultStr;
}
// Fill out all of the details and results now