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

fix newlines not being respected in roll command, fix some followup issues in the [[r or [[roll command variants

This commit is contained in:
Ean Milligan
2025-06-26 04:15:12 -04:00
parent fcae60cb69
commit 41fbb1bd50
2 changed files with 13 additions and 8 deletions

View File

@@ -40,7 +40,7 @@ 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 = `${config.prefix}${command} ${args.join(' ')}`;
const originalCommand = `${config.prefix}${command}${command.length === 0 ? args.join('').trim() : args.join('')}`;
const m = await message.reply(rollingEmbed);
@@ -60,14 +60,14 @@ export const roll = async (message: DiscordenoMessage, args: string[], command:
return;
}
let rollCmd = message.content.startsWith(`${config.prefix}r`) ? remainingArgs.join(' ') : `${config.prefix}${command} ${remainingArgs.join(' ')}`;
let rollCmd = message.content.startsWith(`${config.prefix}r`) ? remainingArgs.join('') : `${config.prefix}${command}${remainingArgs.join('')}`;
// Try to ensure the roll is wrapped
if (!rollCmd.includes(config.prefix)) {
rollCmd = `${config.prefix}${rollCmd}`;
}
if (!rollCmd.includes(config.postfix)) {
rollCmd = `${rollCmd}${config.postfix}`;
rollCmd = `${rollCmd.trim()}${config.postfix}`;
}
if (!rollCmd.includes(config.prefix) || rollCmd.indexOf(config.prefix) > rollCmd.indexOf(config.postfix)) {
rollCmd = `${config.prefix}${rollCmd.trim()}`;
}
sendRollRequest({