Fixed !>5 not working correctly (was misidentified as a numberless option) and added some additional debug to help id issues with tsep parsing in the future

This commit is contained in:
Ean Milligan 2025-07-30 00:42:06 -04:00
parent 657765df00
commit e553042e88
2 changed files with 17 additions and 10 deletions

View File

@ -1,7 +1,7 @@
export const config = {
name: 'The Artificer', // Name of the bot
maxFileSize: 8_388_290, // Max file size bot can send
version: '4.0.0', // Version of the bot
version: '4.0.1', // Version of the bot
token: 'the_bot_token', // Discord API Token for this bot
localtoken: 'local_testing_token', // Discord API Token for a secondary OPTIONAL testing bot, THIS MUST BE DIFFERENT FROM "token"
prefix: '[[', // Prefix for all commands

View File

@ -227,9 +227,13 @@ export const getRollConf = (rollStr: string, customTypes: CustomDiceShapes = new
// Determine if afterSepIdx needs to be moved up (cases like mt! or !mt)
const tempSep = remains.slice(0, afterSepIdx);
loggingEnabled && log(LT.LOG, `tempSep: ${tempSep}`);
let noNumberAfter = false;
if (!(Object.values(DiceOptions) as string[]).includes(tempSep)) {
NumberlessDiceOptions.some((opt) => {
loopCountCheck();
loggingEnabled && log(LT.LOG, `In NumberlessDiceOptions ${opt} ${tempSep.startsWith(opt) && tempSep !== opt}`);
if (tempSep.startsWith(opt) && tempSep !== opt) {
afterSepIdx = opt.length;
noNumberAfter = true;
@ -237,10 +241,13 @@ export const getRollConf = (rollStr: string, customTypes: CustomDiceShapes = new
}
return tempSep === opt;
});
}
// Save the rule name to tSep and remove it from remains
const tSep = remains.slice(0, afterSepIdx);
remains = remains.slice(afterSepIdx);
loggingEnabled && log(LT.LOG, `tSep: ${tSep}, remains: ${remains}`);
// Find the next non-number in the remains to be able to cut out the count/num
let afterNumIdx = noNumberAfter ? 0 : remains.search(/(?![-\d])/);
if (afterNumIdx < 0) {