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 = { export const config = {
name: 'The Artificer', // Name of the bot name: 'The Artificer', // Name of the bot
maxFileSize: 8_388_290, // Max file size bot can send 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 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" localtoken: 'local_testing_token', // Discord API Token for a secondary OPTIONAL testing bot, THIS MUST BE DIFFERENT FROM "token"
prefix: '[[', // Prefix for all commands prefix: '[[', // Prefix for all commands

View File

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