From bbd80c542cb0783c63ee9462815e59cd5373b83d Mon Sep 17 00:00:00 2001 From: kwaroran Date: Mon, 9 Sep 2024 03:37:36 +0900 Subject: [PATCH] allow IN regex string with flag --- src/ts/process/scripts.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ts/process/scripts.ts b/src/ts/process/scripts.ts index e50e25ec..6f7789fb 100644 --- a/src/ts/process/scripts.ts +++ b/src/ts/process/scripts.ts @@ -93,18 +93,24 @@ export async function processScriptFull(char:character|groupChat|simpleCharacter if(outScript.startsWith('@@move_top') || outScript.startsWith('@@move_bottom') || pscript.actions.includes('move_top') || pscript.actions.includes('move_bottom')){ flag = flag.replace('g', '') //temperary fix } - //remove unsupported flag - flag = flag.replace(/[^gimuy]/g, '') if(flag.length === 0){ flag = 'u' } let input = script.in + if(input.startsWith('/')){ + input = input.substring(1) + const rflags = input.slice(input.lastIndexOf('/') + 1) + flag = rflags + input = input.substring(0, input.lastIndexOf('/')) + } if(pscript.actions.includes('cbs')){ input = risuChatParser(input, { chatID: chatID }) } + //remove unsupported flag + flag = flag.replace(/[^gimuy]/g, '') const reg = new RegExp(input, flag) if(outScript.startsWith('@@') || pscript.actions.length > 0){ if(reg.test(data)){