1
1
mirror of https://github.com/Burn-E99/TheArtificer.git synced 2026-06-04 09:03:50 -04:00

properly fix getmodifiers not eating or eating too much, now output format should properly match input format

This commit is contained in:
Ean Milligan
2025-07-09 15:28:02 -04:00
parent dd2fc5b8df
commit 31e32a29c6
2 changed files with 20 additions and 11 deletions

View File

@@ -40,12 +40,19 @@ export const roll = async (message: DiscordenoMessage, args: string[], command:
// Rest of this command is in a try-catch to protect all sends/edits from erroring out
try {
const originalCommand = `${command ? config.prefix : ''}${command}${command.length === 0 ? args.join('').trim() : args.join('')}`;
let originalCommand = `${command}${command.length === 0 ? args.join('').trim() : args.join('')}`;
// Try to ensure the command is wrapped
if (!originalCommand.includes(config.postfix)) {
originalCommand = `${originalCommand.trim()}${config.postfix}`;
}
if (!originalCommand.includes(config.prefix) || originalCommand.indexOf(config.prefix) > originalCommand.indexOf(config.postfix)) {
originalCommand = `${config.prefix}${originalCommand.trim()}`;
}
const m = await message.reply(rollingEmbed);
// Get modifiers from command
const [modifiers, remainingArgs] = getModifiers(args.join('').split(' '));
const [modifiers, remainingArgs] = getModifiers(args);
// Return early if the modifiers were invalid
if (!modifiers.valid) {